GNU bug report logs -
#69093
window-state-put doesn't update current buffer
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 13 Feb 2024 07:46:02 UTC
Severity: normal
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> Martin, could you help to understand what is missing in
>> 'window-state-put' that it doesn't set the current buffer
>> correctly like 'set-window-configuration' does.
>
> The "current buffer" is not part of the state of a window. It is part
> of a more global state. Have a look at frameset.el which does at some
> time "Restore selected frame, buffer and point."
>
> As for what 'set-window-configuration' additionally does, have a look at
> 'current-window-configuration' where you can see that besides
>
> XSETBUFFER (data->f_current_buffer, current_buffer);
>
> it also saves the selected frame, scroll and selected windows of that
> frame's minibuffer or the frame that should receive input focus.
Thanks for explanations. I see this line in 'set-window-configuration':
Fset_buffer (new_current_buffer);
Do you think this is the right fix?
diff --git a/lisp/window.el b/lisp/window.el
index 6df20353b5e..34e6c5d4a4f 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6498,7 +6503,8 @@ window-state-put
(when (and (window-valid-p window)
(eq (window-deletable-p window) t))
(delete-window window))))
- (window--check frame))))
+ (window--check frame)
+ (set-buffer (window-buffer)))))
(defun window-state-buffers (state)
"Return all buffers saved to the given window state STATE."
This bug report was last modified 1 year and 77 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.