unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 59862@debbugs.gnu.org
Cc: martin rudalics <rudalics@gmx.at>
Subject: bug#59862: quit-restore per window buffer
Date: Sun, 02 Jun 2024 09:45:02 +0300	[thread overview]
Message-ID: <86ttibq1w1.fsf@mail.linkov.net> (raw)
In-Reply-To: <86fsds8mlm.fsf@mail.linkov.net> (Juri Linkov's message of "Tue,  06 Dec 2022 19:32:05 +0200")

Martin, do you agree with this?  I tested this patch for a long time.

> 1. C-x 4 d RET C-h C-t q q         -- the bottom window is NOT deleted
> 2. C-x 4 d RET C-h C-t C-x k RET q -- the bottom window is deleted
> 3. C-x 4 d RET C-h C-n C-x k RET q -- the bottom window is NOT deleted
>
> The accidental difference between the last two is that the former uses
> `switch-to-buffer' whereas the latter uses `pop-to-buffer-same-window'.
>
> The root of the problem is that displaying a buffer in an existing
> window, or quitting a buffer in an existing window overwrites its
> window parameter `quit-restore', and thus invalidates the history of
> how the first window was displayed.
>
> A partial fix that solves only the first test case above is at least
> not to overwrite `quit-restore' on quitting other buffers in the same
> window:
>
> diff --git a/lisp/window.el b/lisp/window.el
> index a11293d372a..e3b057599d5 100644
> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -5275,14 +5276,14 @@ quit-restore-window
>  	(set-window-prev-buffers
>  	 window (append (window-prev-buffers window) (list entry))))
>        ;; Reset the quit-restore parameter.
> -      (set-window-parameter window 'quit-restore nil)
>        ;; Select old window.
>        ;; If the previously selected window is still alive, select it.
>        (window--quit-restore-select-window quit-restore-2))
>       (t
>        ;; Show some other buffer in WINDOW and reset the quit-restore
>        ;; parameter.
> -      (set-window-parameter window 'quit-restore nil)
>        ;; Make sure that WINDOW is no more dedicated.
>        (set-window-dedicated-p window nil)
>        ;; Try to switch to a previous buffer.  Delete the window only if
>
> But the proper fix for other problems would be to replace the window
> parameter `quit-restore' currently shared by all buffers in the same window
> by a stack where every window buffer should keep own quit-restore data.
> There is already such a stack in `window-prev-buffers', so a possible
> solution would be to add quit-restore data to each buffer
> in window-prev-buffers.
>
> Alternatively, it would be nice to have an option that would prevent
> overwriting the initial value of the window parameter `quit-restore',
> thus `quit-restore-window' could delete the window regardless of
> how many buffers were displayed in that window, like it does in case
> of dedicated windows.





  reply	other threads:[~2024-06-02  6:45 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 17:32 bug#59862: quit-restore per window buffer Juri Linkov
2024-06-02  6:45 ` Juri Linkov [this message]
2024-06-03  9:34   ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-03  9:53     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-03 16:09       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-04  6:53         ` Juri Linkov
2024-06-05 16:56           ` Juri Linkov
2024-06-11  6:52           ` Juri Linkov
2024-06-12  8:57             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-13  6:47               ` Juri Linkov
2024-06-13  8:21                 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-14 17:35                   ` Juri Linkov
2024-06-15  8:41                     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-16 16:50                       ` Juri Linkov
2024-06-17 14:48                         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-08 16:49                         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-09  6:58                           ` Juri Linkov
2024-07-09  8:52                             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-10  6:50                               ` Juri Linkov
2024-07-10  9:16                                 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-11  6:47                                   ` Juri Linkov
2024-07-11  8:36                                     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-12  6:54                                       ` Juri Linkov
2024-07-12  8:20                                         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-14  7:49                                           ` Juri Linkov
2024-07-15  7:32                                             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-16  6:09                                               ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-16  6:09                                               ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]                                               ` <87frs9kgve.fsf@>
2024-07-16  8:22                                                 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-16 22:14                                                   ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-16 22:14                                                   ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]                                                   ` <871q3tc7da.fsf@>
2024-07-17  9:23                                                     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-30  8:20                                             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-31 17:30                                               ` Juri Linkov
2024-08-01  6:37                                                 ` Juri Linkov
2024-08-01  7:50                                                   ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-01  7:49                                                 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-01 16:01                                                   ` Juri Linkov
2024-10-08 17:53                                                     ` Juri Linkov
2024-10-09  8:46                                                       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-09 16:17                                                         ` Juri Linkov
2024-10-10 14:54                                                           ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-10 18:28                                                             ` Juri Linkov
2024-10-11  7:50                                                               ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-13  6:18                                                                 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ttibq1w1.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=59862@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).