help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Ctrl-[ ?


From: Stefan Monnier
Subject: Re: Ctrl-[ ?
Date: Fri, 14 Jun 2019 02:51:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> Thank you Stefan for the enlightenment.  I did say that I have never
> looked into the source code.  Given what you say, I am curious why C-h
> is not known as Backspace.

There are always 3 entities at play here:

    ASCII-control  |  GUI key   |  GUI control-modified-key
    ---------------------------------------------------
       TAB         |  tab       |  control i
       ESC         |  escape    |  control [
       RET         |  return    |  control m
       LF          |  linefeed  |  control j
       ...

And in Emacs, the mapping from the 3rd column to the 1st is hardcoded in
make_ctrl_char while the mapping from the 2nd to the first is
implemented in function-key-map, which can be easily overridden by the
end-user.

for "backspace" the situation is affected by the fact that some
text-terminal sent "EFF" (aka C-h) for the backspace key while others
sent DEL (aka C-? but it is really the code 127).  Overtime, the C-?
camp won, so Emacs kind of uses:

       DEL         |  backspace | control ?

except that it seems the mapping from "control ?" to DEL is not
hardcoded in the same way so `C-h k C-?` doesn't bring you to the
key binding of DEL.

> Another possibility is that since your patch was applied to all keys, maybe
> it should only check for "special" keys, like these two.  That would
> certainly reduce side effects like you mention.

Indeed.

> Either way the next step would be to make people like me happy and provide
> a default binding that undoes the patch.
> Since this discussion began, I started taking notice of how often I use
> these short-cuts.  I actually caught myself using the sequence C-pC-i today
> to fix indentation on a couple of lines.  I also seem to use C-[C-\ a lot
> because it eliminates the need for me to change modifier-fingering.

If we ever implement a change similar to the proof-of-concept patch
I sent, then of course it would strive to not modify the default
behavior, except maybe in some hard-to-cover corner cases.


        Stefan




reply via email to

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