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
> This fix is needed for this case:
>
> (defun pulse-momentary-highlight-one-line (&optional point face)
> (save-excursion
> (goto-char (or point (point)))
> (let ((start (progn (vertical-motion 0) (point)))
> (end (progn (vertical-motion 1) (point))))
> (pulse-momentary-highlight-region start end face))))
>
> It expects that 'point' should be in the current buffer
> that is displayed in the selected window.
This function will probably not DTRT when the same buffer is displayed
in two windows with different values of point. It should use an overlay
with a 'window' property.
> But this hook fails:
>
> (add-hook 'tab-bar-tab-post-select-functions
> (lambda (_from-tab _to-tab)
> (pulse-momentary-highlight-one-line)))
>
> because this new hook is called in the patch below
> after finishing 'window-state-put' that doesn't
> set the current buffer to the window's buffer.
> So after 'window-state-put' finishes,
> the current buffer stays in some previous buffer.
If by "fails" you mean that 'window-state-put' does not select the
window selected at the time the corresponding 'window-state-get' was
run, then you should fix this in the tab bar code by recording the
frame's selected window together with the state and, depending on
whether the frame you put the state into is selected or not, either set
that frame's selected window or select that window. The latter case
should then make that window's buffer current.
If by "fails" you mean that something in ‘window-state-put’ makes the
selected window not show the current buffer, we have to dig further.
But in neither case use 'set-buffer' to fix a window/buffer relationship
that has been screwed up elsewhere.
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.