Re: Proposal: Bind backspace and delete like DEL in view-mode

From:

Kim F. Storm

Subject:

Re: Proposal: Bind backspace and delete like DEL in view-mode

Date:

20 Dec 2001 23:43:37 +0100

User-agent:

Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

address@hidden (Kai GroÃjohann) writes:
> address@hidden (Kim F. Storm) writes:
>
> > Maybe global-set-key / define-key could be modified so that
> > binding [backspace] (or whatever maps to DEL in function-key-map)
> > actually changed the binding for DEL instead?
>
> I'm not sure this is a good idea. What about people who do the
> following?
>
> (global-unset-key (kbd "<f5>"))
> (define-key function-key-map (kbd "<f5>") (kbd "DEL"))
> (global-set-key (kbd "<backspace>") 'forward-char)
>
> Not that it makes any sense, but I guess you get the idea.
If you are able to write that code, then you can probably also
write
(define-key function-key-map (kbd "<backspace>") nil)
before the last line.
I don't see why one kind of obscure side-effect like having
global-set-key modify function-key-map (which may break a lot of
standard keymaps) is any better that another kind of side-effect like
having global-set-key look for mappings to DEL in function-key-map (to
guard against just that).
Personally, I think the current behaviour of DEL (and ESC, SPC, TAB,
etc) being returned by key-description - but not being recognized by
define-key is really bogus:
- Suppose I want to rebind my backspace key.
- I use C-h k to see what key symbol I need to bind that key.
- It reports "DEL runs the command ...."
- I try to rebind using
(global-set-key [DEL] ....)
- It fails to rebind the backspace key
- So I try this instead:
(global-set-key [backspace] ....)
- Ah, it works
- And breaks everything else
My point is that if I can make such a dumb mistake (thinking that one
can rebind backspace in global-map) after having used emacs for 20
years, it might be worth changing.
I know you will tell me to use (kbd "DEL") instead, but personally
I don't like using kbd; why is (kbd "<f5>") better than [f5] ?
But if we really want to promote using kbd with define-key, something
like the defkey macro posted recently on gnu.emacs.sources seems to be
a really nice approach!
>
> Lars has said before that Gnus gives you all the possibility you
> could possibly want to shoot yourself in the foot, and why should
> Emacs be any worse? :-)
>
At least shooting yourself shouldn't be the obvious choice :-)
--
Kim F. Storm <address@hidden> http://www.cua.dk