emacs-devel
[Top][All Lists]
Advanced

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

Mapping ESC to Cancel in terminal emacs


From: Craig Muth
Subject: Mapping ESC to Cancel in terminal emacs
Date: Sun, 1 Feb 2015 14:39:48 -0800

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



reply via email to

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