[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Munging of del and backspace

On Fri, Apr 11, 2003 at 10:23:24PM +0200, Mikael Hedin wrote:
> >  `DEL' is the ASCII DEL character, which since time immemorial has meant
> > delete-backward-char in emacs.  `Delete' is a labelled key on (some)
> > keyboards, which usually means delete-char.
> Uh, I should have mentioned I run under X.

It doesn't matter -- DEL is really an abstraction used by emacs, even if it
originated with what ASCII character terminals sent.  If emacs were written
today, it might use some other name for this to avoid confusion, but it can't
be changed now (doing so would screw up huge amounts of code that binds DEL).

> For tty emacs, I would understand, but with X, it must be possible to
> distinguish C-d and Delete, just as the <-- key does not bring up the
> help, and tab is different from ^I etc.  

It can distinguish them, and in fact will do so automatically if you just
bind e.g. [backspace] or [delete].  IOW, the mapping of [backspace] to DEL
and [delete] to C-d are _defaults_, and only happens if there's not an
explicit binding for one of the source keys.

Note that `C-h k' says about my <-- key (under X):

   DEL (translated from <backspace>) runs the command delete-backward-char
      which is an interactive built-in function.

If I then do (local-set-key [backspace] 'foo), `C-h k' _now_ says about my
<-- key:

   <backspace> runs the command foo
      which is a Lisp function.

Note that this time, the translation to DEL didn't happen (though it still
happens in other modes, since I used `local-set-key').

The "translation" of [backspace] to DEL is done by `function-key-map', and as
mentioned above, bindings from that are only applied when there's no binding
for the original source key.

> > Rubout.  Because emacs maintains this abstraction, your emacs keybindings
> > should work on any device.
> I.e. you can never make any use of more than basic tty capabilities?

Of course you can; see above.

> And it's annoying that key bindings in emacs and xemacs have different
> results.

I cannot speak for xemacs (well I suppose I don't speak for emacs either, but
at least I have a clue what's going on there).

Suburbia: where they tear out the trees and then name streets after them.

Reply to: