unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36610: [PATCH] Make finder-exit use quit-window
@ 2019-07-11 22:48 Stefan Kangas
  2019-07-11 22:53 ` Stefan Kangas
  2019-07-11 22:57 ` Stefan Kangas
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Kangas @ 2019-07-11 22:48 UTC (permalink / raw)
  To: 36610

When I have two windows open and hit C-h p to open finder, then press q to exit,
the second window is suddenly gone.  This is because finder-exit uses
kill-window instead of quit-window, and is a minor annoyance.

The attached patch fixes that by using quit-window instead.

(I'll send the patch in a separate message once this is assigned a bug
number.)

Thanks,
Stefan Kangas





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

* bug#36610: [PATCH] Make finder-exit use quit-window
  2019-07-11 22:48 bug#36610: [PATCH] Make finder-exit use quit-window Stefan Kangas
@ 2019-07-11 22:53 ` Stefan Kangas
  2019-07-20  9:24   ` Eli Zaretskii
  2019-07-11 22:57 ` Stefan Kangas
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2019-07-11 22:53 UTC (permalink / raw)
  To: 36610

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

Stefan Kangas <stefan@marxist.se> writes:
> (I'll send the patch in a separate message once this is assigned a bug
> number.)

Patch attached.

Thanks,
Stefan Kangas

[-- Attachment #2: 0001-Make-finder-exit-use-quit-window-Bug-33610.patch --]
[-- Type: application/octet-stream, Size: 1004 bytes --]

From cb96a793c793489727b168ddc237743410f95deb Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Fri, 12 Jul 2019 00:43:12 +0200
Subject: [PATCH] Make finder-exit use quit-window (Bug#33610)

* lisp/finder.el (finder-exit): Quit window instead of
deleting.
---
 lisp/finder.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/finder.el b/lisp/finder.el
index ad9441210c..89706cf7db 100644
--- a/lisp/finder.el
+++ b/lisp/finder.el
@@ -465,11 +465,12 @@ finder-summary
 
 (defun finder-exit ()
   "Exit Finder mode.
-Delete the window and kill all Finder-related buffers."
+Quit the window and kill all Finder-related buffers."
   (interactive)
-  (ignore-errors (delete-window))
   (let ((buf "*Finder*"))
-    (and (get-buffer buf) (kill-buffer buf))))
+    (if (equal (current-buffer) buf)
+        (quit-window t)
+      (and (get-buffer buf) (kill-buffer buf)))))
 
 (defun finder-unload-function ()
   "Unload the Finder library."
-- 
2.21.0


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

* bug#36610: [PATCH] Make finder-exit use quit-window
  2019-07-11 22:48 bug#36610: [PATCH] Make finder-exit use quit-window Stefan Kangas
  2019-07-11 22:53 ` Stefan Kangas
@ 2019-07-11 22:57 ` Stefan Kangas
  2019-07-12  6:34   ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2019-07-11 22:57 UTC (permalink / raw)
  To: 36610

Stefan Kangas <stefan@marxist.se> writes:

> When I have two windows open and hit C-h p to open finder, then press q to exit,
> the second window is suddenly gone.  This is because finder-exit uses
> kill-window instead of quit-window, and is a minor annoyance.

That should of course be "delete-window instead of quit-window".





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

* bug#36610: [PATCH] Make finder-exit use quit-window
  2019-07-11 22:57 ` Stefan Kangas
@ 2019-07-12  6:34   ` Eli Zaretskii
  2019-07-12  7:20     ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2019-07-12  6:34 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 36610

> From: Stefan Kangas <stefan@marxist.se>
> Date: Fri, 12 Jul 2019 00:57:26 +0200
> 
> Stefan Kangas <stefan@marxist.se> writes:
> 
> > When I have two windows open and hit C-h p to open finder, then press q to exit,
> > the second window is suddenly gone.  This is because finder-exit uses
> > kill-window instead of quit-window, and is a minor annoyance.
> 
> That should of course be "delete-window instead of quit-window".

Yes, but please also explain the motivation for the change.  In
particular, what do you mean by "gone" in the above description?
Doesn't quit-window also make the window go away, and since you call
it with 2nd arg non-nil, also kill the buffer?  So I'm unsure I
understand the essence of the change and more importantly its
user-visible effects.

Thanks.





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

* bug#36610: [PATCH] Make finder-exit use quit-window
  2019-07-12  6:34   ` Eli Zaretskii
@ 2019-07-12  7:20     ` Stefan Kangas
  2019-07-12  7:57       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2019-07-12  7:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 36610

Eli Zaretskii <eliz@gnu.org> writes:
>
> > From: Stefan Kangas <stefan@marxist.se>
> > Date: Fri, 12 Jul 2019 00:57:26 +0200
> >
> > Stefan Kangas <stefan@marxist.se> writes:
> >
> > > When I have two windows open and hit C-h p to open finder, then press q to exit,
> > > the second window is suddenly gone.  This is because finder-exit uses
> > > kill-window instead of quit-window, and is a minor annoyance.
> >
> > That should of course be "delete-window instead of quit-window".
>
> Yes, but please also explain the motivation for the change.  In
> particular, what do you mean by "gone" in the above description?

The behaviour now is this: When I have two windows open and hit C-h p
that makes Finder display in the window not currently in focus, and
focus moves there.  If I hit q, that window gets deleted (is "gone"),
and I'm left with only one window.

> Doesn't quit-window also make the window go away, and since you call
> it with 2nd arg non-nil, also kill the buffer?

With the attached patch, if I have two windows and hit C-h p and then
q, the display reverts to its previous state.  In other words, I'm
back with two windows displaying the same buffers as before I hit
C-h p.  I think this is more intuitive and allows the user to immediately
get back to her work.

quit-window has heuristics that delete-window lacks.  This is how its
explained in the doc string of quit-window:

    According to information stored in WINDOW’s ‘quit-restore’ window
    parameter either (1) delete WINDOW and its frame, (2) delete
    WINDOW, (3) restore the buffer previously displayed in WINDOW,
    or (4) make WINDOW display some other buffer than the present
    one.  If non-nil, reset ‘quit-restore’ parameter to nil.

Lastly, when we exit Finder, we want to kill the "*Finder*" buffer
too.  This is why quit-window should get a non-nil second argument.
That's the same behaviour as today.

> So I'm unsure I
> understand the essence of the change and more importantly its
> user-visible effects.

Does the above clear it up sufficiently?

Thanks,
Stefan Kangas





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

* bug#36610: [PATCH] Make finder-exit use quit-window
  2019-07-12  7:20     ` Stefan Kangas
@ 2019-07-12  7:57       ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2019-07-12  7:57 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 36610

> From: Stefan Kangas <stefan@marxist.se>
> Date: Fri, 12 Jul 2019 09:20:02 +0200
> Cc: 36610@debbugs.gnu.org
> 
> Does the above clear it up sufficiently?

Yes, thanks.  Please try in the future including such details either
in the bug report, or in the commit log message, or in the comments to
the changes, whatever is appropriate for the case at hand.





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

* bug#36610: [PATCH] Make finder-exit use quit-window
  2019-07-11 22:53 ` Stefan Kangas
@ 2019-07-20  9:24   ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2019-07-20  9:24 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 36610-done

> From: Stefan Kangas <stefan@marxist.se>
> Date: Fri, 12 Jul 2019 00:53:34 +0200
> 
> Stefan Kangas <stefan@marxist.se> writes:
> > (I'll send the patch in a separate message once this is assigned a bug
> > number.)
> 
> Patch attached.

Thanks, pushed to the master branch.





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

end of thread, other threads:[~2019-07-20  9:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11 22:48 bug#36610: [PATCH] Make finder-exit use quit-window Stefan Kangas
2019-07-11 22:53 ` Stefan Kangas
2019-07-20  9:24   ` Eli Zaretskii
2019-07-11 22:57 ` Stefan Kangas
2019-07-12  6:34   ` Eli Zaretskii
2019-07-12  7:20     ` Stefan Kangas
2019-07-12  7:57       ` Eli Zaretskii

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).