I have a kinesis keyboard and would like to have the home key act as super in emacs without requiring me to remap my keyboard as well as edit my key bindings. Is there a simple way of doing this?
-
1As far as I know, you cannot turn any arbitrary key into a modifier key in Emacs -- you would need to look at rebinding the key at the OS level. See related question emacs.stackexchange.com/questions/3272/….– glucasMar 1, 2016 at 17:15
-
I think that's doable (kinda) through key-chord. @glucas– Gilles 'SO- stop being evil'Mar 10, 2016 at 12:45
-
Is your goal to use existing super- bindings? As @Gilles noted with key-chord you could re-define any super- bindings to achieve a similar effect. Although you could also just make home a prefix key with its own key map, if you don't really need it to behave like a true modifier.– glucasMar 10, 2016 at 15:00
1 Answer
The closest thing to a solution I know of is to do this:
(define-key key-translation-map (kbd "<home>") #'event-apply-super-modifier)
It's not quite the same as turning home
into super
though. Specifically, if you press home
, release it, and then press e.g. a
, Emacs will interpret it as s-a
even though you released home
before pressing a
.
That's not necessarily a bad thing (in fact, it can have ergonomic benefits), but it may not be what you want (and it can be a bit weird to have this one modifier work that way, if you don't configure the others to behave the same).
Of course, there are event-apply-*-modifier
functions for other modifiers as well. Modifiers that apply to keys after you've released them are sometimes referred to as "sticky modifiers".