unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30315: [PATCH] keyboard-escape-quit should give option not to delete windows
@ 2018-02-01  2:59 Alex Branham
  2018-02-01 19:26 ` Richard Stallman
  2018-02-01 20:29 ` Juri Linkov
  0 siblings, 2 replies; 5+ messages in thread
From: Alex Branham @ 2018-02-01  2:59 UTC (permalink / raw)
  To: 30315

[-- Attachment #1: Type: text/plain, Size: 3323 bytes --]

I've always found it a bit odd that ESC-ESC-ESC deletes windows, since I
think of it as telling Emacs to "stop doing whatever it is you're
doing". I guess there's a case to be made that splitting the frame is
doing something, but it's behavior I'm not a huge fan of.

The attached patch introduces a new defcustom that allows the user to
stop ESC-ESC-ESC from deleting windows. I'm not sure if this should be
documented in the manual or not. If so, please let me know (and where?).

Thanks for all your work!
Alex

--------------------

From 30351ba514094b2364298b7723ae7c33685bf53e Mon Sep 17 00:00:00 2001
From: Alex Branham <branham@utexas.edu>
Date: Wed, 31 Jan 2018 20:44:55 -0600
Subject: [PATCH] New defcustom `keyboard-escape-quit-deletes-windows'

* lisp/simple.el (`keyboard-escape-quit-deletes-windows'): New
  defcustom to control whether keyboard-escape-quit calls
  delete-other-windows
(keyboard-escape-quit): Use it

* etc/NEWS: Mention `keyboard-escape-quit-deletes-windows'.
---
 etc/NEWS       |  5 +++++
 lisp/simple.el | 11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index b28f284116..d6ba6f28b8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -80,6 +80,11 @@ indirectly, e.g., by checking that functions like
 It blocks line breaking after a one-letter word, also in the case when
 this word is preceded by a non-space, but non-alphanumeric character.

+** New option 'keyboard-escape-quit-deletes-windows'.
+This determines whether 'keyboard-escape-quit' eventually calls
+'delete-other-windows'.  The default (t) preserves behavior from
+previous Emacs.
+
 +++
 ** The limit on repetitions in regexps has been raised to 2^16-1.
 It was previously limited to 2^15-1.  For example, the following
diff --git a/lisp/simple.el b/lisp/simple.el
index 375ee31e9c..695bb12ac1 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7706,6 +7706,11 @@ At top-level, as an editor command, this simply beeps."
   (let ((debug-on-quit nil))
     (signal 'quit nil)))

+(defcustom keyboard-escape-quit-deletes-windows t
+  "If non-nil, `keyboard-escape-quit' eventually calls `delete-other-windows'."
+  :group 'windows
+  :type 'boolean)
+
 (defvar buffer-quit-function nil
   "Function to call to \"quit\" the current buffer, or nil if none.
 \\[keyboard-escape-quit] calls this function when its more local actions
@@ -7717,7 +7722,8 @@ 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)."
+or go back to just one window (by deleting all but the selected window, but
+see `keyboard-escape-quit-deletes-windows')."
   (interactive)
   (cond ((eq last-command 'mode-exited) nil)
 	((region-active-p)
@@ -7730,7 +7736,8 @@ or go back to just one window (by deleting all but the selected window)."
 	 (exit-recursive-edit))
 	(buffer-quit-function
 	 (funcall buffer-quit-function))
-	((not (one-window-p t))
+	((and (not (one-window-p t))
+              keyboard-escape-quit-deletes-windows)
 	 (delete-other-windows))
 	((string-match "^ \\*" (buffer-name (current-buffer)))
 	 (bury-buffer))))
--
2.16.1

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-New-defcustom-keyboard-escape-quit-deletes-windows.patch --]
[-- Type: text/x-patch, Size: 2794 bytes --]

From 30351ba514094b2364298b7723ae7c33685bf53e Mon Sep 17 00:00:00 2001
From: Alex Branham <branham@utexas.edu>
Date: Wed, 31 Jan 2018 20:44:55 -0600
Subject: [PATCH 1/1] New defcustom `keyboard-escape-quit-deletes-windows'

* lisp/simple.el (`keyboard-escape-quit-deletes-windows'): New
  defcustom to control whether keyboard-escape-quit calls
  delete-other-windows
(keyboard-escape-quit): Use it

* etc/NEWS: Mention `keyboard-escape-quit-deletes-windows'.
---
 etc/NEWS       |  5 +++++
 lisp/simple.el | 11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index b28f284116..d6ba6f28b8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -80,6 +80,11 @@ indirectly, e.g., by checking that functions like
 It blocks line breaking after a one-letter word, also in the case when
 this word is preceded by a non-space, but non-alphanumeric character.
 
+** New option 'keyboard-escape-quit-deletes-windows'.
+This determines whether 'keyboard-escape-quit' eventually calls
+'delete-other-windows'.  The default (t) preserves behavior from
+previous Emacs.
+
 +++
 ** The limit on repetitions in regexps has been raised to 2^16-1.
 It was previously limited to 2^15-1.  For example, the following
diff --git a/lisp/simple.el b/lisp/simple.el
index 375ee31e9c..695bb12ac1 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7706,6 +7706,11 @@ At top-level, as an editor command, this simply beeps."
   (let ((debug-on-quit nil))
     (signal 'quit nil)))
 
+(defcustom keyboard-escape-quit-deletes-windows t
+  "If non-nil, `keyboard-escape-quit' eventually calls `delete-other-windows'."
+  :group 'windows
+  :type 'boolean)
+
 (defvar buffer-quit-function nil
   "Function to call to \"quit\" the current buffer, or nil if none.
 \\[keyboard-escape-quit] calls this function when its more local actions
@@ -7717,7 +7722,8 @@ 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)."
+or go back to just one window (by deleting all but the selected window, but
+see `keyboard-escape-quit-deletes-windows')."
   (interactive)
   (cond ((eq last-command 'mode-exited) nil)
 	((region-active-p)
@@ -7730,7 +7736,8 @@ or go back to just one window (by deleting all but the selected window)."
 	 (exit-recursive-edit))
 	(buffer-quit-function
 	 (funcall buffer-quit-function))
-	((not (one-window-p t))
+	((and (not (one-window-p t))
+              keyboard-escape-quit-deletes-windows)
 	 (delete-other-windows))
 	((string-match "^ \\*" (buffer-name (current-buffer)))
 	 (bury-buffer))))
-- 
2.16.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#30315: [PATCH] keyboard-escape-quit should give option not to delete windows
  2018-02-01  2:59 bug#30315: [PATCH] keyboard-escape-quit should give option not to delete windows Alex Branham
@ 2018-02-01 19:26 ` Richard Stallman
  2019-06-24 15:28   ` Lars Ingebrigtsen
  2018-02-01 20:29 ` Juri Linkov
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2018-02-01 19:26 UTC (permalink / raw)
  To: Alex Branham; +Cc: 30315

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > I've always found it a bit odd that ESC-ESC-ESC deletes windows, since I
  > think of it as telling Emacs to "stop doing whatever it is you're
  > doing".

Its intended meaning is "Get me back to the default state of things."
It's meant for people who don't know Emacs very well, to get out of
any kind of temporary state that they might have got themselves into
and don't know the command to get out of,

Splitting into multiple windows is one such temporary state.
So it is right that this gets back to the one-window state.

However, I have no objection to adding this option, if it's
useful enough to justify its added complexity.


-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Skype: No way! See https://stallman.org/skype.html.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30315: [PATCH] keyboard-escape-quit should give option not to delete windows
  2018-02-01  2:59 bug#30315: [PATCH] keyboard-escape-quit should give option not to delete windows Alex Branham
  2018-02-01 19:26 ` Richard Stallman
@ 2018-02-01 20:29 ` Juri Linkov
  2018-02-02  2:15   ` Richard Stallman
  1 sibling, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2018-02-01 20:29 UTC (permalink / raw)
  To: Alex Branham; +Cc: 30315

> I've always found it a bit odd that ESC-ESC-ESC deletes windows, since I
> think of it as telling Emacs to "stop doing whatever it is you're
> doing". I guess there's a case to be made that splitting the frame is
> doing something, but it's behavior I'm not a huge fan of.
>
> The attached patch introduces a new defcustom that allows the user to
> stop ESC-ESC-ESC from deleting windows. I'm not sure if this should be
> documented in the manual or not. If so, please let me know (and where?).

But what if other users don't like other things in ‘keyboard-escape-quit’
or their priorities.  Shouldn't all its actions be customizable?
For example, I'd prefer to have this rule somewhere in the middle:

  ((eq major-mode 'wdired-mode)
   (wdired-abort-changes))

Maybe better to change the implementation of ‘keyboard-escape-quit’
to use ‘add-function’ from nadvice.el, so it would be easier to add/delete
some actions from it?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30315: [PATCH] keyboard-escape-quit should give option not to delete windows
  2018-02-01 20:29 ` Juri Linkov
@ 2018-02-02  2:15   ` Richard Stallman
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2018-02-02  2:15 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 30315, alex.branham

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > But what if other users don't like other things in ‘keyboard-escape-quit’
  > or their priorities.  Shouldn't all its actions be customizable?

The function is 16 lines and straightforward.
You could write another function to replace it.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Skype: No way! See https://stallman.org/skype.html.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30315: [PATCH] keyboard-escape-quit should give option not to delete windows
  2018-02-01 19:26 ` Richard Stallman
@ 2019-06-24 15:28   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-24 15:28 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 30315, Alex Branham

Richard Stallman <rms@gnu.org> writes:

>   > I've always found it a bit odd that ESC-ESC-ESC deletes windows, since I
>   > think of it as telling Emacs to "stop doing whatever it is you're
>   > doing".
>
> Its intended meaning is "Get me back to the default state of things."
> It's meant for people who don't know Emacs very well, to get out of
> any kind of temporary state that they might have got themselves into
> and don't know the command to get out of,
>
> Splitting into multiple windows is one such temporary state.
> So it is right that this gets back to the one-window state.
>
> However, I have no objection to adding this option, if it's
> useful enough to justify its added complexity.

It didn't seem like anybody was really enthusiastic about adding this
complication to this functionality, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-24 15:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-01  2:59 bug#30315: [PATCH] keyboard-escape-quit should give option not to delete windows Alex Branham
2018-02-01 19:26 ` Richard Stallman
2019-06-24 15:28   ` Lars Ingebrigtsen
2018-02-01 20:29 ` Juri Linkov
2018-02-02  2:15   ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).