How do I bind a key to "the function represented by the following key sequence"?
Posted
by
katrielalex
on Stack Overflow
See other posts from Stack Overflow
or by katrielalex
Published on 2010-12-26T22:25:30Z
Indexed on
2010/12/26
23:54 UTC
Read the original article
Hit count: 219
I'm just starting to learn emacs (woohoo!) and I've been mucking around in my .emacs
quite happily. Unfortunately, I don't know Lisp yet, so I'm having issues with the basics.
I've already remapped a few keys until I fix my muscle memory:
(global-set-key (kbd "<f9>") 'recompile)
That's fine. But how can I tell a key to 'simulate pressing several keys'? For instance, I don't know, make <f1>
do the same as C-u 2 C-x }
(widen buffer by two chars).
One way is to look up that C-x }
calls shrink-window-horizontally
, and do some sort of lambda thing. This is of course the neat and elegant way (how do you do this?). But surely there's a way to define <f1>
to send the keystrokes C-u 2 C-x }
?
© Stack Overflow or respective owner