From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#69093: window-state-put doesn't update current buffer Date: Wed, 21 Feb 2024 19:27:37 +0200 Organization: LINKOV.NET Message-ID: <86y1bdviba.fsf@mail.linkov.net> References: <86il2s6cva.fsf@mail.linkov.net> <2387160a-717f-4164-a0ad-cd831cabd60f@gmx.at> <86cysy1c7e.fsf@mail.linkov.net> <9bc224fd-265b-42a6-9315-9e1caa9e7172@gmx.at> <86msryw7gy.fsf@mail.linkov.net> <86il2jhb7o.fsf@mail.linkov.net> <843eff0e-134a-4ade-8c9f-c49166f85241@gmx.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28246"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 69093@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 21 18:40:16 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rcqZr-0007DK-Vt for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Feb 2024 18:40:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcqZK-00011M-WE; Wed, 21 Feb 2024 12:39:43 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcqZJ-0000ry-J8 for bug-gnu-emacs@gnu.org; Wed, 21 Feb 2024 12:39:41 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcqZJ-0003JB-B2 for bug-gnu-emacs@gnu.org; Wed, 21 Feb 2024 12:39:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcqZf-0003sF-MS for bug-gnu-emacs@gnu.org; Wed, 21 Feb 2024 12:40:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Feb 2024 17:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69093 X-GNU-PR-Package: emacs Original-Received: via spool by 69093-submit@debbugs.gnu.org id=B69093.170853719514840 (code B ref 69093); Wed, 21 Feb 2024 17:40:03 +0000 Original-Received: (at 69093) by debbugs.gnu.org; 21 Feb 2024 17:39:55 +0000 Original-Received: from localhost ([127.0.0.1]:57178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcqZX-0003rF-27 for submit@debbugs.gnu.org; Wed, 21 Feb 2024 12:39:55 -0500 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:37641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcqZQ-0003qB-6F for 69093@debbugs.gnu.org; Wed, 21 Feb 2024 12:39:48 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id E5BDB20007; Wed, 21 Feb 2024 17:38:58 +0000 (UTC) In-Reply-To: <843eff0e-134a-4ade-8c9f-c49166f85241@gmx.at> (martin rudalics's message of "Wed, 21 Feb 2024 10:04:54 +0100") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280408 Archived-At: > I'd say that saving a window configuration where the current buffer is > _not_ shown in the selected window is never right. So can you give me a > practical example where you think that this > >> + (set-buffer (window-buffer)))) > > is useful or needed? 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. 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. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 3e1d8278b04..50679f54474 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1499,7 +1565,10 @@ tab-bar-select-tab (tab-bar--current-tab-make (nth to-index tabs))) (unless tab-bar-mode - (message "Selected tab '%s'" (alist-get 'name to-tab)))) + (message "Selected tab '%s'" (alist-get 'name to-tab))) + + (run-hook-with-args 'tab-bar-tab-post-select-functions + from-tab to-tab)) (force-mode-line-update))))