GNU bug report logs - #69093
window-state-put doesn't update current buffer

Previous Next

Package: emacs;

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 69093 <at> debbugs.gnu.org
Subject: bug#69093: window-state-put doesn't update current buffer
Date: Fri, 16 Feb 2024 10:39:36 +0100
> Thanks for explanations.  I see this line in 'set-window-configuration':
>
>        Fset_buffer (new_current_buffer);
>
> Do you think this is the right fix?

No.  I think the right fix would be to remove the above line from
'set-window-configuration'.  We can't do that because some applications
might depend on the current behavior.  But I am quite confident that
nobody fully understands 'set-window-configuration' anyway and can
predict what it does when selected frame, current buffer and the buffer
and frame stored in the CONFIGURATION argument mismatch.

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

I think that the behavior of

(let ((frame (selected-frame))
      (state (window-state-get)))
  (pop-to-buffer "*Messages*" '((display-buffer-pop-up-frame)))
  (window-state-put state (frame-root-window frame))
  (current-buffer))

is much more consistent in this regard.

I'd say that any code run in a state where the buffer of the selected
window and the current buffer are not the same - regardless of whether
this happens when a state/configuration is saved or restored - should
simply report an error.  But that ship has sailed long ago.

martin




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.