Question

How do I get Emacs to recognize M-C (meta-shift-c) rather than translating it as m-c?

Currently when I do C-h k M-C I get: M-c (translated from M-C) runs the command capitalize-word.

How do I get it to NOT translate M-C to M-c?

Was it helpful?

Solution

Just use modifier S (Shift) in your key binding. E.g.:

(global-set-key "\M-\S-c" 'foobar)

If there is nothing explicitly bound to the shifted key then Emacs automatically translates it to the unshifted key.

From the Elisp manual, node Key Sequence Input:

If an input character is upper-case (or has the shift modifier) and has no key binding, but its lower-case equivalent has one, then read-key-sequence' converts the character to lower case. Note thatlookup-key' does not perform case conversion in this way.

OTHER TIPS

To get Emacs to distinguish the two is very easy: add a binding for M-C. The translation from M-C to M-c happens as a fallback when no binding was found for M-C.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top