all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bob Proulx <bob@proulx.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Sticky escape key
Date: Sun, 20 Sep 2015 17:37:04 -0600	[thread overview]
Message-ID: <20150920171415942580642@bob.proulx.com> (raw)
In-Reply-To: <8737yb2jgl.fsf@debian.uxu>

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	other threads:[~2015-09-20 23:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18 13:05 Sticky escape key Surya Kiran Gullapalli
2015-09-18 22:54 ` Emanuel Berg
2015-09-18 22:59 ` Bob Proulx
2015-09-19  3:09   ` Emanuel Berg
2015-09-20 23:37     ` Bob Proulx [this message]
2015-09-21  0:06       ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150920171415942580642@bob.proulx.com \
    --to=bob@proulx.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.