From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: 46904@debbugs.gnu.org
Subject: bug#46904: Non-unique windows produced by window-state-put
Date: Tue, 27 Apr 2021 20:19:21 +0300 [thread overview]
Message-ID: <87im47myqu.fsf@mail.linkov.net> (raw)
In-Reply-To: <c972b1f6-3c55-62a0-782e-42cdfb1b90a1@gmx.at> (martin rudalics's message of "Thu, 4 Mar 2021 09:35:26 +0100")
[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]
>> I don't know how severe are the consequences. The only side-effect I noticed
>> that prev-buffers of restored windows are the same on different tabs because
>> they share the same window.
>
> If that is a problem and the above would help, let's do it. It couldn't
> possibly harm unless the root window is too small to get split and we
> want to put only one window there; so we should handle that special case.
The original problem was that prev-buffers of restored windows are the
same on different tabs. This was fixed by always creating a new window.
However, the same problem still exists, but for a different reason.
Most windows have current buffer duplicated in prev-buffers. So when
set-window-prev-buffers in window--state-put-2 sets prev-buffers to a list
with only current buffer, this means as if there are no prev-buffers.
But when a window has an empty list of prev-buffers, then the window
parameter of prev-buffers is not cleared, and still contains a random
buffer from some previous state. This patch fixes it:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: window--state-put-2-prev-buffers.patch --]
[-- Type: text/x-diff, Size: 631 bytes --]
diff --git a/lisp/window.el b/lisp/window.el
index 036eb271ee..fc4ca303b0 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6140,7 +6140,8 @@ window--state-put-2
(setq buffer (get-buffer buffer))
(when (buffer-live-p buffer) buffer))
next-buffers))))
- (when prev-buffers
+ (if (not prev-buffers)
+ (set-window-prev-buffers window nil)
(set-window-prev-buffers
window
(delq nil (mapcar (lambda (entry)
next prev parent reply other threads:[~2021-04-27 17:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 20:13 bug#46904: Non-unique windows produced by window-state-put Juri Linkov
2021-03-04 8:35 ` martin rudalics
2021-03-04 9:39 ` Juri Linkov
2021-03-04 10:34 ` martin rudalics
2021-03-04 17:57 ` Juri Linkov
2021-03-04 20:31 ` Juri Linkov
2021-03-05 9:10 ` martin rudalics
2021-03-07 18:43 ` Juri Linkov
2021-03-08 8:26 ` martin rudalics
2021-03-08 17:18 ` Juri Linkov
2021-03-08 18:06 ` martin rudalics
2021-03-08 18:24 ` Juri Linkov
2021-03-09 17:28 ` Juri Linkov
2021-04-27 17:19 ` Juri Linkov [this message]
2021-04-28 20:25 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87im47myqu.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=46904@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.