1

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.

  • Try using describe-key on both keys. It might be translated. – DoMiNeLa10 Apr 22 at 16:38
  • @DoMiNeLa10, that works as expected. just curious about this behaviour. – Toothrot Apr 22 at 16:39
  • Does it mention that keys are translated in some way? If they are, that's your answer - someone set them up to be translated, and you might even get a link to see where it's been done. – DoMiNeLa10 Apr 22 at 17:14
  • @DoMiNeLa10, no, this happens with -q. – Toothrot Apr 22 at 17:17
  • 1
    I can't reproduce that from emacs -Q. Is this in a terminal? OS may also affect key input. – npostavs Apr 22 at 17:42
2

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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.