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
>>> Or could you tell beforehand which buffer will be current after
>>>
>>> (let ((configuration (current-window-configuration)))
>>> (pop-to-buffer "*Messages*" '((display-buffer-pop-up-frame)))
>>> (set-window-configuration configuration)
>>> (current-buffer))
>>
>> Does this ambiguity exist only for multi-frame setups where
>> a system window manager decides what frame to select afterwards?
>
> The system window manager here does only what Emacs tells it to do. But
> note that multi-frame setups got more and more broken since Emacs 26 and
> are maybe not used frequently nowadays. So you probably needn't give
> them much attention in the first place.
Ok, since it's impossible to fix 'window-state-put',
let's narrow the scope just to the single-frame case
in the caller 'tab-bar-select-tab':
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index d653f339fea..efca893fc16 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1477,7 +1489,8 @@ tab-bar-select-tab
;; `window-state-put' fails when called in the minibuffer
(when (window-minibuffer-p)
(select-window (get-mru-window)))
- (window-state-put ws nil 'safe)))
+ (window-state-put ws nil 'safe)
+ (set-buffer (window-buffer))))
;; Select the minibuffer when it was active before switching tabs
(when (and minibuffer-was-active (active-minibuffer-window))
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.