From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bob Proulx Newsgroups: gmane.emacs.help Subject: Re: Sticky escape key Date: Sun, 20 Sep 2015 17:37:04 -0600 Message-ID: <20150920171415942580642@bob.proulx.com> References: <20150918164750569537901@bob.proulx.com> <8737yb2jgl.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1442792253 5198 80.91.229.3 (20 Sep 2015 23:37:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Sep 2015 23:37:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 21 01:37:26 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZdoAe-0002RQ-FN for geh-help-gnu-emacs@m.gmane.org; Mon, 21 Sep 2015 01:37:24 +0200 Original-Received: from localhost ([::1]:54224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdoAd-0008Kl-Gr for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Sep 2015 19:37:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdoAR-0008KO-TX for help-gnu-emacs@gnu.org; Sun, 20 Sep 2015 19:37:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZdoAN-0000Hy-1m for help-gnu-emacs@gnu.org; Sun, 20 Sep 2015 19:37:11 -0400 Original-Received: from joseki.proulx.com ([216.17.153.58]:56169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdoAM-0000Ha-LE for help-gnu-emacs@gnu.org; Sun, 20 Sep 2015 19:37:06 -0400 Original-Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 5B63121232 for ; Sun, 20 Sep 2015 17:37:04 -0600 (MDT) Original-Received: by hysteria.proulx.com (Postfix, from userid 1000) id 203C12DC4D; Sun, 20 Sep 2015 17:37:04 -0600 (MDT) Mail-Followup-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <8737yb2jgl.fsf@debian.uxu> User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 216.17.153.58 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107259 Archived-At: 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