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

前端 未结 1 940
耶瑟儿~
耶瑟儿~ 2020-12-04 02:24

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

相关标签:
1条回答
  • 2020-12-04 03:20

    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.

    0 讨论(0)
提交回复
热议问题