Why the key binding M-S-t fails while C-S-t works?

余生颓废 提交于 2019-12-17 14:55:13

问题


I got the question from this question, it seems we can't bind shift with meta like M-S-t (always translated to M-t), but we can do it with control like C-S-t (works as C-T).

As the accepted answer said, we can use M-T instead, but why we can't use it with meta? Does Emacs just ignore shift when used with meta?


回答1:


I think Emacs ignores S- for letters when Ctrl is not also used.

i.e. it's nothing to do with Meta in particular; the same thing applies to the other non-Ctrl modifiers (and indeed without other modifiers -- you also can't bind to plain S-t).

The justification may be that Ctrl keys are the only case where an explicit shift modifier is needed for letters:

(emacs) Modifier Keys says

The default key bindings in Emacs are set up so that modified
alphabetical characters are case-insensitive.  In other words, ‘C-A’
does the same thing as ‘C-a’, and ‘M-A’ does the same thing as ‘M-a’.
This concerns only alphabetical characters, and does not apply to
“shifted” versions of other keys; for instance, ‘C-@’ is not the same as
‘C-2’.

   A <Control>-modified alphabetical character is always considered
case-insensitive: Emacs always treats ‘C-A’ as ‘C-a’, ‘C-B’ as ‘C-b’,
and so forth.  The reason for this is historical.

   For all other modifiers, you can make the modified alphabetical
characters case-sensitive when you customize Emacs.  For instance, you
could make ‘M-a’ and ‘M-A’ run different commands.

By my recollection terminals do not distinguish case for control characters, so I would speculate that the "historical" reasons are related to that.

It would be reasonable for this to at least be documented in the manual. You may wish to M-x report-emacs-bug to suggest such an improvement, if no relevant bug exists at present.

Note that the Shift modifier can be used with non-letter keys, with or without other modifiers. M-S-SPC is a recognised sequence, for example.



来源:https://stackoverflow.com/questions/38180797/why-the-key-binding-m-s-t-fails-while-c-s-t-works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!