bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#69093: window-state-put doesn't update current buffer


From: Juri Linkov
Subject: bug#69093: window-state-put doesn't update current buffer
Date: Tue, 20 Feb 2024 09:40:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>>> 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))






reply via email to

[Prev in Thread] Current Thread [Next in Thread]