all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: 69093@debbugs.gnu.org
Subject: bug#69093: window-state-put doesn't update current buffer
Date: Thu, 22 Feb 2024 09:58:12 +0100	[thread overview]
Message-ID: <abf42b2f-8867-4d8b-8d46-d9c5e281e634@gmx.at> (raw)
In-Reply-To: <86y1bdviba.fsf@mail.linkov.net>

 > 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

  reply	other threads:[~2024-02-22  8:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  7:39 bug#69093: window-state-put doesn't update current buffer Juri Linkov
2024-02-14  9:12 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-15  7:29   ` Juri Linkov
2024-02-16  9:39     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-16 11:46       ` Eli Zaretskii
2024-02-18  7:43       ` Juri Linkov
2024-02-19  9:43         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-19 17:36           ` Drew Adams
2024-02-20  7:40           ` Juri Linkov
2024-02-21  9:04             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-21 17:27               ` Juri Linkov
2024-02-22  8:58                 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-02-22 17:23                   ` Juri Linkov
2024-02-23  8:48                     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-24 17:32                       ` Juri Linkov
2024-02-25  9:17                         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-25 18:19                           ` Juri Linkov
2024-02-26  8:42                             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-04  9:40                               ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-05 17:14                                 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abf42b2f-8867-4d8b-8d46-d9c5e281e634@gmx.at \
    --to=bug-gnu-emacs@gnu.org \
    --cc=69093@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.