问题
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.
回答1:
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).
来源:https://stackoverflow.com/questions/38140280/what-causes-m-s-t-meta-shift-t-key-binding-not-to-take