[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to prevent ESC from closing frames
From: |
sokobania . 01 |
Subject: |
Re: How to prevent ESC from closing frames |
Date: |
Fri, 29 Aug 2014 02:09:19 -0700 (PDT) |
User-agent: |
G2/1.0 |
Le vendredi 29 août 2014 05:47:04 UTC+2, Yuri Khan a écrit :
> On Thu, Aug 28, 2014 at 2:13 PM, abdo.haji.ali wrote:
> ESC ESC ESC (translated from <escape> <escape> <escape>) runs the
> command keyboard-escape-quit, which is an interactive compiled Lisp
> function in `simple.el'.
>
> It is bound to M-ESC ESC.
>
> (keyboard-escape-quit)
>
> Exit the current "mode" (in a generalized sense of the word).
> This command can exit an interactive command such as `query-replace',
> can clear out a prefix argument or a region,
> can get out of the minibuffer or other recursive edit,
> cancel the use of the current buffer (for special-purpose buffers),
> **or go back to just one window (by deleting all but the selected window).**
>
> I have looked at the source of this function and it does not check any
> variables that could be used to control its features. So, no, you
> can't, at least not directly.
Well, the code of keyboard-escape-quit tests the variable buffer-quit-function.
So something like the following could work...
(while at least keeping some of keyboard-escape-quit functionalities):
(setq-default buffer-quit-function
#'(lambda () (message "Are you trying to quit?")))
Or you might rebind ESC-ESC-ESC like this:
(define-key global-map "\e\e\e"
#'(lambda () (interactive) (message "Are you trying to quit?")))