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

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

Re: Sticky escape key


From: Bob Proulx
Subject: Re: Sticky escape key
Date: Sun, 20 Sep 2015 17:37:04 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

Emanuel Berg wrote:
> Bob Proulx writes:
> > You mapped it how? What did you do? Did you do it
> > with the keyboard? With the terminal? With X and
> > xmodmap? With setxkbmap? With a checkbox from your
> > desktop manager dialog box? Some other method?
> 
> It seems to me from reading the OP's post that he
> succeeded remapping the left control key to the escape
> key, then he setup some shortcuts which uses the
> escape key, and those also work, only the key
> "sticks" - which is exactly what the escape key does!

Ah...  So you are thinking that the original poster is trying to hold
down escape along with other keys in a chord the same way that control
and shift are used?  Basically conflating escape with meta?  Hmm...  I
guess that is possible and I had not considered that.

> But: Escape already does what meta does only meta
> doesn't stick. When the OP sets up shortcuts with
> escape he might as well use meta! (Or it is actually
> better because it is what you expect.) Because:

Yes and no.  I mean yes meta can be used when meta can be used.  But
often an actual escape is needed such as C-x ESC ESC
repeat-complex-command and so forth.  That requires a real escape and
not using escape to meta-ize the next character.

>     (global-set-key (kbd "ESC r") (lambda () (interactive) (message "ESC-r is 
> M-r")))
> 
> Try this with escape and meta!
>
> So the OP should rebind the left control key to meta
> and that will do what he wants.

You may be right about that.  But maybe not too.  There is already the
left alt that is usually bound to meta.  And a lot of people bind
escape to the control key.  It is hard to say what is actually desired
there.  Plus there is the problem of running in a text terminal.
(Personally I bind Control_L to CAPLOCK and Escape to Control_L in
xmodmap so it is global outside of emacs for everything and am very
happy.)

> > Yes. No. Maybe. It can't be done for emacs running in
> > a terminal because the terminal needs to know the
> > difference between escape and control.
> 
> In the ttys, you can rebind escape with the familiar
> method [1]. The escape key has keycode 1. You can then
> do whatever with that key. Only it still "sticks"!
> I don't know if Emacs or the terminal does that, but
> I'll find out.
> 
> [1] http://user.it.uu.se/~embe8573/tty-emacs-keys.txt

Here we may be differing on a definition of "sticks".  To me that
would be like capslock.  When I turn on capslock it sticks and all
characters typed after that point are in caps.  To me that is a sticky
key.  And in the modern age with sticky shift on such things as touch
screens then it is also a capslock and is called sticky.  But escape
is only like a sticky meta key for exactly one character.  As you know
escape causes the next character to be interpreted as a meta
character.  But after that folllowing characters are not meta
characters.  I wouldn't describe that as sticky.

Here you are talking about the Linux tty console which operates quite
differently from a graphics terminal emulator running under X such as
most people use these days.  Under the Linux console I have had the
following in my /etc/rc.local for quite a while to remap my keys.

  dumpkeys --full-table | sed -n '/^keycode  *29/p;/^keycode  *58/p' | sed 
'/^keycode  *29/s/Control/Escape/g;/^keycode  *58/s/CtrlL_Lock/Control/g' | 
loadkeys -q

That dumps the full table.  Then the sed -n only prints out the two
lines for keycodes 29 Control and 58 CtrlL_Lock.  Then it changes the
keycode 29 Control to keycode 29 Escape and keycode 58 CtrlL_Lock to
keycode 58 Control.  This way even on the Linux console I get the old
style keyboard arrangement such as the HP-UX HIL keyboard that I
liked.  This doesn't do anything with Alt and Meta because Alt is
already Meta on the Linux console.  But it does set capslock to be
control and the left control to be escape as I like.

Hopefully the original poster will respond and let us know whether
they are wanting capslock to be a meta key or an escape key.

Bob



reply via email to

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