Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causes `M-S-t` (meta + shift + t) key binding not to take? [duplicate]

By default, C-S-t and M-S-t are both unbound in my Emacs. Hence, when I press them, they are translated into C-t and M-t. Fine, but I want to use them for a tweak on the original function, and therefore put these lines in my .emacs:

(global-set-key (kbd "C-S-t") 'transpose-chars-backward)
(global-set-key (kbd "M-S-t") 'transpose-words-backward)

The functions there are my own, and work fine when called via M-x.

This works for C-S-t, but not for M-S-t which still gets translated to M-t. The message on C-h k M-S-t confirms this.

It's not that it's impossible to configure M-S- combinations in general, because M-q and M-S-q do different things.

What causes this inconsistency and how can I get around it?

I'm running Aquamacs on Mac OS X 10.9.5.

like image 823
njlarsson Avatar asked Mar 12 '23 20:03

njlarsson


1 Answers

Here you have two different ways to do what you want:

(global-set-key (kbd "M-T") 'transpose-words-backwards)
(global-set-key [(meta shift t)] 'transpose-words-backwards)

I am not sure what causes the (kbd "M-S-t") working differently from (kbd "C-S-t"), btw. Time ago I became an adept to vector notation ([(meta shift t)]) as I find it more predictable (I always get it right the first time, and with kbd notation sometimes I needed a couple of tries).

like image 121
juanleon Avatar answered May 09 '23 01:05

juanleon