GNU bug report logs -
#32850
27.0.50; window-swap-states doesn't swap window prev/next-buffers
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 27 Sep 2018 00:06:02 UTC
Severity: minor
Found in version 27.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #106 received at 32850 <at> debbugs.gnu.org (full text, mbox):
>>> The most simple way to find out is to define such a list in window.c
>>> and have 'set-window-prev-buffers' holler if the prev_buffers argument
>>> is equal to that list.
>>
>> I can't find out how '(nil nil nil)' gets into the prev-buffers,
>
> Did you try what I proposed? If that doesn't catch it, I have no
> idea. IIUC mark_discard_killed_buffers just removes entries from that
> list, it cannot introduce any nil valued elements.
>
>> so to avoid the error, I propose to install this patch:
>
> Well this will just cache the underlying problem. But I have no good
> idea how to investigate this issue any furher, so install if you like.
Now I found a reproducible test case:
1. create and remember a window-configuration
2. switch to a different window-configuration
3. kill the buffer that was in prev-buffers of the
first window-configuration
4. restore the first window-configuration
5. look into its prev-buffers, it contains:
(#<killed buffer> #<marker in no buffer> #<marker in no buffer>)
6. (window-state-get nil t) on the window with such prev-buffers
produces:
(nil nil nil)
I believe this patch should fix the problem:
diff --git a/lisp/window.el b/lisp/window.el
index 27d7e42280..ad8164052f 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5552,9 +5552,14 @@ window--state-get-1
(buffer (window-buffer window))
(selected (eq window (selected-window)))
(next-buffers (when (window-live-p window)
- (window-next-buffers window)))
+ (delq nil (mapcar (lambda (buffer)
+ (and (buffer-live-p buffer) buffer))
+ (window-next-buffers window)))))
(prev-buffers (when (window-live-p window)
- (window-prev-buffers window)))
+ (delq nil (mapcar (lambda (entry)
+ (and (buffer-live-p (nth 0 entry))
+ entry))
+ (window-prev-buffers window)))))
(head
`(,type
,@(unless (window-next-sibling window) `((last . t)))
This bug report was last modified 6 years and 183 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.