Prior to Emacs 21, vanilla GnuEmacs did not bother with angle brackets either, but someone around the turn of the century had the bright idea that Emacs could not do without them. So instead of the
‘delete’ key we now have the `
<delete>’ key. And instead of
‘C-x M-delete’ we now have `
C-x M-<delete>’. On n’arrete pas le progres !
If you think that’s silly, well, now there are two of us…
All I can think of is that some misguided soul forgot that we already use spaces to separate keys in a key-sequence description (we use
‘SPC’ to indicate the
SPACE key). So we don’t need no stinkin’ brackets to separate keys. Perhaps someone thought we could not distinguish
‘C-d elete’ from
‘C-delete’ (the former being the two-key sequence
‘C-d’ followed by the yet-to-be-defined function key
Well, we can distinguish them, and no, we do not need angle brackets, because we already have spaces to separate keys in a sequence.
To be fair, it is true that sometimes people have taken the shortcut when writing about user input of writing, e.g.,
‘M-x forward-char RET’ instead of writing
‘M-x f o r w a r d - c h a r’. And if you write
‘forward’ that way to stand for an input sequence of seven chars, then you cannot also expect
‘forward’ to stand for a function key named “forward”, can you?
Well, yes you can, if the context makes things clear enough. And I for one (maybe the only one), find `
C-M-<insert>’ butt-ugly (likewise `
<C-M-insert>’) – and, more importantly, insulting to Occam.
So go ahead and go NaKeD – shed your angles.
Here’s what you need. It won’t completely purge Emacs from insulting you with the occasional pair of angle brackets, but it at least lets you DTRT in code you write:
‘key-description’. The former outputs naked key descriptions: no angle brackets around function keys. E.g., if
KEYis the sequence of events produced by holding the
Shiftkey while hitting the
"S-<insert>"). (Internally, this sequence of events is the vector
‘kbd’(which is a function starting with Emacs 24.3 and a macro before then). The former accepts its argument key-sequence description whether it uses angle bracket or naked key notation. E.g.,
(naked "C-M-delete")has the same effect as
(naked "C-M-<delete>"), which is the same as the effect of
‘edmacro-parse-keys’(if you happen to use that lower-level function).
All of these also accept an optional argument
ANGLES which, if non-
‘nil’, returns the behavior to the brain-dead vanilla one, expecting function keys to be fully clothed in angle brackets. Example:
(naked "C-M-<delete>" t).
In fact, when you use non-
ANGLES they even respect the vanilla behavior when it is bugged – E.g. bug #12535. For an argument of “
M-<TAB>” they return
[M-TAB] instead of
 (which is what
‘kbd’ returns for argument “
I will contact you by mail once I have looked into this a bit more. – JonasBernoulli
Please try the latest. I uploaded a fix for the
‘M-TAB’ case, which was indeed a bug. The code was not handling
‘M-TAB’ differently from
‘M-tab’. This is fixed in naked.el, and I submitted vanilla Emacs bug #12535 about this, with a patch. I also made
‘naked’ handle angle-bracketed key descriptions even without non-
ANGLES. In that case, #12535 is fixed, but I left it unfixed for the non-
ANGLES case, to be consistent with vanilla Emacs.
Thx. Feel free to follow up with anything else (e.g., your functions). – DrewAdams