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: Thu, 15 Feb 2024 09:29:33 +0200 Organization: LINKOV.NET Message-ID: <86cysy1c7e.fsf@mail.linkov.net> References: <86il2s6cva.fsf@mail.linkov.net> <2387160a-717f-4164-a0ad-cd831cabd60f@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="36852"; 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 Thu Feb 15 08:44:20 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 1raWPr-0009UW-W8 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Feb 2024 08:44:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raWPN-0002rq-PJ; Thu, 15 Feb 2024 02:43:49 -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 1raWPI-0002r0-KH for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 02:43:45 -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 1raWPI-0002hN-BZ for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 02:43:44 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raWPa-0007gp-Qi for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 02:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Feb 2024 07:44:02 +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.170798300529487 (code B ref 69093); Thu, 15 Feb 2024 07:44:02 +0000 Original-Received: (at 69093) by debbugs.gnu.org; 15 Feb 2024 07:43:25 +0000 Original-Received: from localhost ([127.0.0.1]:53904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raWOy-0007fV-JR for submit@debbugs.gnu.org; Thu, 15 Feb 2024 02:43:24 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:58225) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raWOv-0007ew-36 for 69093@debbugs.gnu.org; Thu, 15 Feb 2024 02:43:22 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id AE17540007; Thu, 15 Feb 2024 07:42:35 +0000 (UTC) In-Reply-To: <2387160a-717f-4164-a0ad-cd831cabd60f@gmx.at> (martin rudalics's message of "Wed, 14 Feb 2024 10:12:04 +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:280044 Archived-At: >> Martin, could you help to understand what is missing in >> 'window-state-put' that it doesn't set the current buffer >> correctly like 'set-window-configuration' does. > > The "current buffer" is not part of the state of a window. It is part > of a more global state. Have a look at frameset.el which does at some > time "Restore selected frame, buffer and point." > > As for what 'set-window-configuration' additionally does, have a look at > 'current-window-configuration' where you can see that besides > > XSETBUFFER (data->f_current_buffer, current_buffer); > > it also saves the selected frame, scroll and selected windows of that > frame's minibuffer or the frame that should receive input focus. Thanks for explanations. I see this line in 'set-window-configuration': Fset_buffer (new_current_buffer); Do you think this is the right fix? diff --git a/lisp/window.el b/lisp/window.el index 6df20353b5e..34e6c5d4a4f 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -6498,7 +6503,8 @@ window-state-put (when (and (window-valid-p window) (eq (window-deletable-p window) t)) (delete-window window)))) - (window--check frame)))) + (window--check frame) + (set-buffer (window-buffer))))) (defun window-state-buffers (state) "Return all buffers saved to the given window state STATE."