From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Craig Muth Newsgroups: gmane.emacs.devel Subject: Mapping ESC to Cancel in terminal emacs Date: Sun, 1 Feb 2015 14:39:48 -0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1422830400 17621 80.91.229.3 (1 Feb 2015 22:40:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Feb 2015 22:40:00 +0000 (UTC) To: Emacs-Devel devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 01 23:40:00 2015 Return-path: Envelope-to: ged-emacs-devel@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 1YI3BP-0007Mq-Pf for ged-emacs-devel@m.gmane.org; Sun, 01 Feb 2015 23:39:59 +0100 Original-Received: from localhost ([::1]:52151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YI3BP-0002aT-6u for ged-emacs-devel@m.gmane.org; Sun, 01 Feb 2015 17:39:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YI3BK-0002aM-E1 for emacs-devel@gnu.org; Sun, 01 Feb 2015 17:39:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YI3BH-0007gw-9J for emacs-devel@gnu.org; Sun, 01 Feb 2015 17:39:54 -0500 Original-Received: from mail-qa0-x232.google.com ([2607:f8b0:400d:c00::232]:33694) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YI3BH-0007gs-44 for emacs-devel@gnu.org; Sun, 01 Feb 2015 17:39:51 -0500 Original-Received: by mail-qa0-f50.google.com with SMTP id k15so26974651qaq.9 for ; Sun, 01 Feb 2015 14:39:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Daf3U0umlSr4cwtUSK9wrOpjW1vnNnGAcyFJ/Z1Nto4=; b=SDX0JIcmR+X5G/zol2Gwh0D1Cs2b1PuNADKUHN4a7IHNKxzhuyYKdofkre/Z49Us+Z t/G4Mkn3MGvpI5MByl08H+jWPbMbIInDfD9qxzknoeKjkqN0+WQjzVtc4gT+y8XSUHIF DbRBWsNAihPKtmfVEJz/N5l6n+hwFjKtWxhB0PXLR78jnjdL2hNOvHNqTsHFm0ddPTRV gnIGmvc5EQgqb7MyRmaN0AO5n49JxKpwLKaSt/uYs5e43nUumEyFkmPSFqCoQBD18WH/ 943twj1yXfMtucWGP3CjZpxDHfA0i3O0bsABGvhxd9BfsbGRd2yE4/DERqalvltSuVAz KxXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=Daf3U0umlSr4cwtUSK9wrOpjW1vnNnGAcyFJ/Z1Nto4=; b=jVjey83ejtkQvuycrmZBhhWkPpFfKO8SLggFkjfQXBH2mjUEwmIM0w4ezWQXaqmSMU 0L1zx4OGRsIonoANH4DjbSkBNHr8X4T4g1m/RKTBvPEEhaRmjOKLp+i7TvOEDXdcTWr4 EvbZywki1rGE4/LSt35zku8QfUXVCc0G6v5XaZG482ePcO0R4iHPpfjTXXXy7lEMcPwS Bio4qQQ23PbSrdHN6Y3wU8wWuNtIB50sMUt0+9xIr/yJc7KgxaegDnW5us21+r7pMl2d F2oqWOBApuoVOgBEjZpei7MQomz7KE+CQca8T8Ia7Xs7JbbjjsBntArG+sYlZEk0S8QA bWzA== X-Received: by 10.140.95.179 with SMTP id i48mr33672140qge.4.1422830390273; Sun, 01 Feb 2015 14:39:50 -0800 (PST) Original-Received: from mail-qg0-f53.google.com (mail-qg0-f53.google.com. [209.85.192.53]) by mx.google.com with ESMTPSA id i19sm16588208qaq.19.2015.02.01.14.39.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 01 Feb 2015 14:39:49 -0800 (PST) Original-Received: by mail-qg0-f53.google.com with SMTP id a108so45234967qge.12 for ; Sun, 01 Feb 2015 14:39:48 -0800 (PST) X-Gm-Message-State: ALoCoQkQNJ9w5wJmFjeKWqbYVgBEnZ6l17P6VmgXwYw+/QhpM0WjHbipPHQr3SNZnSI98Da+L0q7 X-Received: by 10.224.7.197 with SMTP id e5mr36307871qae.64.1422830388948; Sun, 01 Feb 2015 14:39:48 -0800 (PST) Original-Received: by 10.140.101.151 with HTTP; Sun, 1 Feb 2015 14:39:48 -0800 (PST) X-Originating-IP: [73.162.159.180] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c00::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:182220 Archived-At: I added some elisp to the following emacswiki page that gets somewhat close to making ESC behave like C-g. It uses a small cua-mode-like delay to distinguish using ESC as a prefix key from an ESC to cancel: http://www.emacswiki.org/emacs/CancelingInEmacs Anyone know of a better way to put something like "\eb" back into unread-command-events, so it replicate the state before the event was read? Here's a relevant blurb I added at the bottom of the emacswiki page: ------------------------------------------------------------------- One drawback, though, is that it messes up C-h C-k, making it think the key you typed was only escape. Does anyone know of a better way of putting the escape and the subsequent key back into effect than the following? Maybe a way that makes it not treat the escape separately? (setq unread-command-events (cons event unread-command-events)) ; Puts subsequent key back into effect (setq unread-command-events (cons 27 unread-command-events)) ; Puts escape back into effect ------------------------------------------------------------------- Caveat: I do fully realize that making escape work like C-g in a general way is a bad idea. I have in mind the exceptional case where emacs is used as an engine, or when you're temporarily remapping escape while pairing with a user who isn't yet familiar with emacs. Thanks! --Craig