I noticed something odd. If I press M-P
I get the message M-p is
undefined
rather than M-P etc.
. Is there a reason for this?
Version 26.2. Using Arch Linux and the X window system.
I noticed something odd. If I press M-P
I get the message M-p is
undefined
rather than M-P etc.
. Is there a reason for this?
Version 26.2. Using Arch Linux and the X window system.
It's a feature. Refer to this duplicate Q&A on the main S.O. site:
https://stackoverflow.com/a/54591047/324105
It's still slightly misleading, given that in your case the lower-case sequence also has no binding (as the docs imply that the translation only occurs when there is a lower-case binding), but I think it's all part and parcel of the same mechanism.
read_key_sequence
contains the following comments:
/* If KEY is not defined in any of the keymaps,
and cannot be part of a function key or translation,
and is an upper case letter
use the corresponding lower-case letter instead. */
[...]
/* We have to do this unconditionally, regardless of whether
the lower-case char is defined in the keymaps, because they
might get translated through function-key-map. */
[...]
shift_translated = true;
describe-key
on both keys. It might be translated. – Apr 22 '19 at 16:38-q
. – Toothrot Apr 22 '19 at 17:17emacs -Q
. Is this in a terminal? OS may also affect key input. – npostavs Apr 22 '19 at 17:42M-P
" did you mean pressAlt+Shift+p
orAlt+p
? – npostavs Apr 22 '19 at 17:50(progn (define-key global-map (kbd "M-P") 'foo) (define-key global-map (kbd "M-p") 'bar))
do you get different results? – npostavs Apr 22 '19 at 17:55