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#46904: Non-unique windows produced by window-state-put Date: Sun, 07 Mar 2021 20:43:40 +0200 Organization: LINKOV.NET Message-ID: <87pn0bj617.fsf@mail.linkov.net> References: <877dmo0zdn.fsf@mail.linkov.net> <87a6rj8dhe.fsf@mail.linkov.net> <87lfb2izev.fsf@mail.linkov.net> <8735xar85l.fsf@mail.linkov.net> <9bd9f7dd-a4d5-6d64-f784-f63f532efa10@gmx.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24482"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 46904@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 07 19:52:28 2021 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 1lIyVv-0006Er-OR for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 19:52:27 +0100 Original-Received: from localhost ([::1]:43804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIyVu-0006lw-RU for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 13:52:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIyVX-0006KL-A9 for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 13:52:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58186) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIyVX-0005z7-2g for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 13:52:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lIyVX-0005cP-1c for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 13:52: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: Sun, 07 Mar 2021 18:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46904 X-GNU-PR-Package: emacs Original-Received: via spool by 46904-submit@debbugs.gnu.org id=B46904.161514307921503 (code B ref 46904); Sun, 07 Mar 2021 18:52:02 +0000 Original-Received: (at 46904) by debbugs.gnu.org; 7 Mar 2021 18:51:19 +0000 Original-Received: from localhost ([127.0.0.1]:41490 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIyUo-0005al-SP for submit@debbugs.gnu.org; Sun, 07 Mar 2021 13:51:19 -0500 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:55685) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIyUl-0005aU-36 for 46904@debbugs.gnu.org; Sun, 07 Mar 2021 13:51:17 -0500 Original-Received: from mail.gandi.net (m91-129-108-46.cust.tele2.ee [91.129.108.46]) (Authenticated sender: juri@linkov.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id A121F100006; Sun, 7 Mar 2021 18:51:06 +0000 (UTC) In-Reply-To: <9bd9f7dd-a4d5-6d64-f784-f63f532efa10@gmx.at> (martin rudalics's message of "Fri, 5 Mar 2021 10:10:31 +0100") 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" Xref: news.gmane.io gmane.emacs.bugs:201759 Archived-At: --=-=-= Content-Type: text/plain >> Actually with this patch window-swap-states fails with the error >> "Wrong type argument: stringp, nil" in: >> >> ;; Swap basic states. >> (window-state-put state-1 window-2 t) >> (window-state-put state-2 window-1 t) >> ;; Swap overlays with `window' property. >> (with-current-buffer (window-buffer window-1) >> >> Here '(window-buffer window-1)' returns nil because >> window-1 doesn't exist anymore after calling window-state-put. > > We could easily handle that by having `window-state-put' return the > window actually used for putting the state into and use that in > `window-swap-states'. Yet someone else might use `window-state-put' in > much the same way as `window-swap-states' does and we have a quite > incompatible change: We nowhere say that the window used as second > argument of `window-state-put' will be live if it was so before, but we > neither say that it can be deleted. So I'm not sure what to do ... Indeed, this would be an incompatible change. So better to fix callers not to use frame-root-window that is unreliable: sometimes frame-root-window returns an internal window, sometimes a live window: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=window-state-put-without-frame-root-window.patch diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 917b5e496b..a7d905184b 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -766,7 +772,7 @@ tab-bar-select-tab tab-bar-history-forward))) (ws - (window-state-put ws (frame-root-window (selected-frame)) 'safe))) + (window-state-put ws nil 'safe))) (setq tab-bar-history-omit t) --=-=-=--