In your terminal Emacs
session try this
(define-key input-decode-map (kbd "<select>") (kbd "<end>"))
and see if the problem goes away. (It should)
This is a temporary band-aid solution. You need to collect more information to fix this problem cleanly.
In your *scratch*
buffer, can you do C-q
, followed by the pressing of End
key, and post a screenshot of what you see there. This will help us see the "raw" stuff that terminal is sending to Emacs
.
I also suggest that you see if there are any changes to terminfo
files. Btw, are you working on a remote machine (emacsclient/server), or is it all on the same machine?
What does C-h k End
report.
On my end, on xterm
it reports the key as <end>
.
The only trace of [select]
in xterm.el
is in
(define-key map "\e[4~" [select])
and the only trace of [end]
in xterm.el
is (define-key map "\eOF" [end])
, both defined as part of xterm-rxvt-function-map
xterm-rxvt-function-map
is a parent map of xterm-function-map
and is pushed on to the input-decode-map
What is the value of TERM
?
In gnome-terminal
, I get
~$ env | grep TERM
COLORTERM=truecolor
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/7c41a066_78c0_4cf5_bd9b_7b51193e3fed
TERM=xterm-256color
GNOME_TERMINAL_SERVICE=:1.107
In xterm
, I get
~$ env | grep TERM
XTERM_VERSION=XTerm(372)
XTERM_SHELL=/bin/bash
XTERM_LOCALE=en_IN
TERM=xterm
The value that is reported is then looked up in term-file-aliases
to make terminal specific configuration.
I see no entry for konsole
in term-file-aliases
(possibly because I am running GNOME Desktop?).
term-file-aliases
is a variable defined in faces.el
.
Its value is shown below.
Alist of terminal type aliases. Entries are of the form (TYPE
. ALIAS
), where both elements are strings. This means to treat a terminal of type TYPE
as if it were of type ALIAS
.
This variable was introduced, or its default value was changed, in version 25.1 of Emacs. You can customize this variable.
Value:
(("apollo" . #1="vt100")
("vt102" . #1#)
("vt125" . #1#)
("vt201" . #2="vt200")
("vt220" . #2#)
("vt240" . #2#)
("vt300" . #2#)
("vt320" . #2#)
("vt400" . #2#)
("vt420" . #2#)
("alacritty" . #3="xterm")
("foot" . #3#))
A quick look at konsole.el suggests that it considers konsole
just the same as xterm
.
Since you say that you don't have issues with xterm
, on konsole
, why don't you start Emacs
with
TERM=xterm emacs -nw
etc etc
and see if the problem goes away.
A quick look of where [end]
is defined in Emacs
source.
-*- mode: rg; default-directory: "~/src/emacs/lisp/" -*-
rg started at Tue Oct 18 11:45:27
/usr/bin/rg --color=always --colors=match:fg:red --colors=path:fg:magenta --colors=line:fg:green --colors=column:none -n --column --type-add=gyp\:\*.gyp --type-add=gyp\:\*.gypi -i --heading --no-config --type=elisp -e \\\[end\\\]
File: term/AT386.el
42 38 (define-key AT386-keypad-map "Y" [end])
File: term/iris-ansi.el
240 31 (define-key map "\e[146q" [end])
301 33 ;;(define-key map "\e[146q" [end])
File: term/xterm.el
280 28 (define-key map "\eOF" [end])
File: term/rxvt.el
45 29 (define-key map "\e[8~" [end])
File: term/ns-win.el
161 24 (define-key global-map [end] 'end-of-buffer)
File: term.el
942 21 (define-key map [end] 'term-send-end)
File: term/wyse50.el
60 25 ("\e\^^" [end])
File: emulation/edt-pc.el
82 41 ("SELECT" . [delete]) ("PREVIOUS" . [end]) ("NEXT" . [next])
File: eshell/em-term.el
323 35 ; (define-key eshell-term-raw-map [end] 'eshell-term-send-end)
File: bindings.el
1180 24 (define-key global-map [end] 'move-end-of-line)
1183 24 (define-key esc-map [end] 'end-of-buffer-other-window)
File: hexl.el
129 21 (define-key map [end] 'hexl-end-of-line)
File: forms.el
273 4 ;; [end] forms-last-record
rg finished (14 matches found) at Tue Oct 18 11:45:27
A quick look at where [select]
is defined Emacs
source
-*- mode: rg; default-directory: "~/src/emacs/lisp/" -*-
rg started at Tue Oct 18 11:47:24
/usr/bin/rg --color=always --colors=match:fg:red --colors=path:fg:magenta --colors=line:fg:green --colors=column:none -n --column --type-add=gyp\:\*.gyp --type-add=gyp\:\*.gypi -i --heading --no-config --type=elisp -e \\\[select\\\]
File: term/xterm.el
158 29 (define-key map "\e[4~" [select])
File: term/lk201.el
15 29 (define-key map "\e[4~" [select])
File: term/news.el
48 38 (define-key news-fkey-prefix "b" [select])
File: emulation/edt-lk201.el
52 17 ("SELECT" . [select]) ("PREVIOUS" . [prior]) ("NEXT" . [next])
File: textmodes/bibtex.el
3753 28 (define-key menu-map [select]
File: bindings.el
1187 27 ;; (define-key global-map [select] 'function-key-error)
File: obsolete/tpu-edt.el
321 21 (define-key map [select] #'tpu-unselect) ; Select
495 21 (define-key map [select] #'tpu-select) ; Select
rg finished (8 matches found) at Tue Oct 18 11:47:24
From
(info "(elisp) Translation Keymaps")
Translation keymaps take effect only after Emacs has decoded the keyboard input (via the input coding system specified by keyboard-coding-system
). *Note Terminal I
/O
Encoding::.
-- Variable: input-decode-map
This variable holds a keymap that describes the character sequences sent by function keys on an ordinary character terminal.
The value of input-decode-map
is usually set up automatically according to the terminal's Terminfo or Termcap entry, but sometimes those need help from terminal-specific Lisp files. Emacs comes with terminal-specific files for many common terminals; their main purpose is to make entries in input-decode-map
beyond those that can be deduced from Termcap and Terminfo. *Note Terminal-Specific::.
-- Variable: local-function-key-map
This variable holds a keymap similar to input-decode-map
except that it describes key sequences which should be translated to alternative interpretations that are usually preferred. It applies after input-decode-map
and before key-translation-map
.
Entries in local-function-key-map
are ignored if they conflict with bindings made in the minor mode, local, or global keymaps. I.e., the remapping only applies if the original key sequence would otherwise not have any binding.
local-function-key-map
inherits from function-key-map
. The latter should only be altered if you want the binding to apply in all terminals, so using the former is almost always preferred.
-- Variable: key-translation-map
This variable is another keymap used just like input-decode-map
to translate input events into other events. It differs from input-decode-map
in that it goes to work after local-function-key-map
is finished rather than before; it receives the results of translation by local-function-key-map
.
Just like input-decode-map
, but unlike local-function-key-map
, this keymap is applied regardless of whether the input key-sequence has a normal binding. Note however that actual key bindings can have an effect on key-translation-map
, even though they are overridden by it. Indeed, actual key bindings override local-function-key-map
and thus may alter the key sequence that key-translation-map
receives. Clearly, it is better to avoid this type of situation.