emacs-devel
[Top][All Lists]
Advanced

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

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: 26 Dec 2001 23:26:08 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

Richard Stallman <address@hidden> writes:

>     I see two ways to improve (or fix) the currrent behaviour:
> 
>     1) Modify define-key so that it will recognize DEL, TAB, etc as
>        synonymous for the actual characters.
> 
> I see no improvement here--but I am not really sure what this
> concretely means.  What action would you change the meaning of?
> What would you make it do?

If I enter C-h k <backspace>, emacs tells me:

        DEL runs the command delete-backward-char

Since emacs tells me that the <backspace> key's "internal" name
is DEL, I would like to be able to rebind it using

        (define-key map [DEL] ...)

This is currently not possible - instead users have to know that
DEL is synonymous with ascii 127 and know about octal notation to
write something like

        (define-key map "\177" ...)

Since this is complicated, I guess some users (as I did) would
find out that

        (define-key map [backspace] ...)

seems to do the same thing - but it doesn't since it has the effect of
ignoring the binding of backspace to DEL in function-key-map if the
map is global-map.

So to summarise, I simply want emacs to recognize the same key names
as it uses itself to report key bindings to the user!

Those names are: DEL, TAB, ESC, RET and SPC.

> 
> Anyway, what does TAB have to do with this?  We have not made any
> change in the handling of TAB recently; if you redefine "\t", it will
> work just as it always did.

Sure, but how does the novice user that TAB is "\t".

> 
>     2) Modify define-key so that, when binding a key which maps to DEL in
>        function-key-map, DEL is mapped instead - unless a new optional
>        argument NO-REMAP is non-nil.
> 
> This might perhaps be a good idea.  But it might be better just to
> signal an error--that way, people will learn to bind the key they
> ought to bind.

I wouldn't mind doing that - but it inhibits the advanced user from
actually rebinding the keys which he might actually like to remap -
and novice users may suddenly start getting errors for bindings
which (seem to) have been working fine for a long time...

With my proposal, the majority of users will not notice any difference,
as it will DTRT for all practical purposes.


BTW, it would be extremely trivial to modify define-key to accept
a single key symbol or integer as the KEY argument (automatically
wrapping it to a one-element vector).

This would allow users to write things like

        (define-key map 'DEL ...)
        (define-key map ?\C-a ...)

Why not?

-- 
Kim F. Storm <address@hidden> http://www.cua.dk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]