[Arcana] problems with <deletechar>?

Jim Blandy jimb at red-bean.com
Sat Dec 27 02:01:00 CST 2008

On Wed, Dec 24, 2008 at 11:22 PM, Karl Fogel <kfogel at red-bean.com> wrote:
> David Carlton <carlton at bactrian.org> writes:
>> Thanks, I'll look in that area.  (One other thing I found bemusing: C-h
>> k refers to it as <deletechar>, but if I want to, say,
>> global-set-key-it, I have to refer to it as [deletechar].)
> Oh, that's it!  You have to pull on the ends of the angle brackets to
> straighten them, then crimp the top and bottom to get square braces.
> So obvious.  Yay Emacs.

Well, the history is that, in Emacs 19, we started representing some
keys using symbols, because they didn't have direct representations in
ASCII.  This allowed us to give real names to function keys, tab,
delete, backspace, enter, return, mouse buttons, and so on and so
forth, instead of the obscure, illegible, and non-portable escape
sequences we'd been using before.

But then, how does one represent a key sequence, when keys can be
either characters or symbols?  Vectors, obviously.

Karl, I know you knew all that.

When logging in from a Mac terminal, I assume that the Mac sends some
escape sequence when you hit the delete key.  There is some keymap
somewhere (I'm using Vivienne's Mac at the moment, and I'll be screwed
if I turn on my computer at this hour, so I can't find the exact name
of the keymap) that maps escape sequences to symbols representing
function keys; Emacs automatically traverses this keymap in parallel
with everything else and replaces matching escape sequences with the
function key symbols to which they're bound, so that people can say
stuff like (global-set-key [f1] 'foo).  This
escape-sequence-to-function-key table is seeded with information based
on your terminal type.  So:

1) You might want to see if there is a terminal type that better
matches your Mac.  There may not be.
2) You might want to modify that escape-sequence-to-function-key table
to map the sequence your delete key sends to good old 'delete'.  I
think if you hit C-q and then hit your delete key, you'll get the
sequence inserted into your buffer.

More information about the Arcana mailing list