From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#32850: 27.0.50; window-swap-states doesn't swap window prev/next-buffers Date: Sun, 28 Oct 2018 21:29:33 +0200 Organization: LINKOV.NET Message-ID: <87woq2xn22.fsf@mail.linkov.net> References: <875zyrrhk8.fsf@mail.linkov.net> <87ftx79brv.fsf@mail.linkov.net> <5BC5A536.7020603@gmx.at> <8736t57jcs.fsf@mail.linkov.net> <5BC6E559.3090000@gmx.at> <87zhvcteuy.fsf@mail.linkov.net> <5BC83EE4.8030607@gmx.at> <87h8hig9uw.fsf@mail.linkov.net> <5BC98A5F.5050807@gmx.at> <87ftx0nvoi.fsf@mail.linkov.net> <5BCC374E.603@gmx.at> <87a7n7kz7x.fsf@mail.linkov.net> <5BCD935F.8030309@gmx.at> <87in1szirt.fsf@mail.linkov.net> <5BD03F21.6040807@gmx.at> <87lg6map8e.fsf@mail.linkov.net> <5BD15CE0.7080703@gmx.at> <87va5qf1ox.fsf@mail.linkov.net> <5BD2C4AD.3060402@gmx.at> <87r2gbb85y.fsf@mail.linkov.net> <5BD57AB5.2040105@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1540755560 9355 195.159.176.226 (28 Oct 2018 19:39:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 28 Oct 2018 19:39:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 32850@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 28 20:39:16 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGqu3-0002LL-J6 for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Oct 2018 20:39:15 +0100 Original-Received: from localhost ([::1]:41759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGqwA-0004sQ-4y for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Oct 2018 15:41:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGqvr-0004lE-E7 for bug-gnu-emacs@gnu.org; Sun, 28 Oct 2018 15:41:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gGqvo-0007Um-90 for bug-gnu-emacs@gnu.org; Sun, 28 Oct 2018 15:41:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45092) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gGqvo-0007UY-3W for bug-gnu-emacs@gnu.org; Sun, 28 Oct 2018 15:41:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gGqvo-00054c-05 for bug-gnu-emacs@gnu.org; Sun, 28 Oct 2018 15:41:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Oct 2018 19:41:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32850 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32850-submit@debbugs.gnu.org id=B32850.154075562819416 (code B ref 32850); Sun, 28 Oct 2018 19:41:03 +0000 Original-Received: (at 32850) by debbugs.gnu.org; 28 Oct 2018 19:40:28 +0000 Original-Received: from localhost ([127.0.0.1]:49344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGqvE-000536-Cz for submit@debbugs.gnu.org; Sun, 28 Oct 2018 15:40:28 -0400 Original-Received: from common.maple.relay.mailchannels.net ([23.83.214.38]:30142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGqvC-00052y-QJ for 32850@debbugs.gnu.org; Sun, 28 Oct 2018 15:40:27 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 71EC7502387; Sun, 28 Oct 2018 19:40:25 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a9.g.dreamhost.com (unknown [100.96.29.126]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 3662D501A34; Sun, 28 Oct 2018 19:40:25 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a9.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Sun, 28 Oct 2018 19:40:25 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Battle-Reign: 57eebbbf3e833eb2_1540755625334_3371305255 X-MC-Loop-Signature: 1540755625334:2189969970 X-MC-Ingress-Time: 1540755625334 Original-Received: from pdx1-sub0-mail-a9.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a9.g.dreamhost.com (Postfix) with ESMTP id EA5B37F795; Sun, 28 Oct 2018 12:40:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=ckwVdMxqei4sIrmDZsjOr4lYQhw=; b= Xqr8lszuSMcB0Cyj9TUitW/3khczfBPAlx/Q3czj4gZeY6aedcrjPajfFdg/p2ma CT9v0yJCCRWk1EeW/jrYzZ+BPTGEcHo0HdH+Sw6OzdpKFmNERfd5Qzh+PdWXvcJO TLod/XFyF6TTxQOJHZXYy4JAfv2deOOLqb4DOTFlKls= Original-Received: from mail.jurta.org (m91-129-105-154.cust.tele2.ee [91.129.105.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a9.g.dreamhost.com (Postfix) with ESMTPSA id 000D67F794; Sun, 28 Oct 2018 12:40:22 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a9 In-Reply-To: <5BD57AB5.2040105@gmx.at> (martin rudalics's message of "Sun, 28 Oct 2018 10:00:37 +0100") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrheeigddufedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdehrdduheegnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedrudehgedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehruhgurghlihgtshesghhmgidrrghtnecuvehluhhsthgvrhfuihiivgeptd X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151755 Archived-At: > What you probably want is a facility to clone a window. I have no > idea how to do that and which semantics to attach to a cloned window. I guess a cloned window implies the same state with a different identity. > You can put a window state into any valid window, usually the frame's > root window. I see no difference, still the same problem is that window-state-put doesn't create a new window: (let* ((orig-window (catch 'live (walk-window-subtree (lambda (window) (when (window-live-p window) (throw 'live window))) (frame-root-window (selected-frame))))) (orig-window-state (window-state-get (frame-root-window (selected-frame)) 'writable))) (window-state-put orig-window-state (frame-root-window (selected-frame)) 'safe) (eq orig-window (catch 'live (walk-window-subtree (lambda (window) (when (window-live-p window) (throw 'live window))) (frame-root-window (selected-frame)))))) returns t that indicates the problem. Thus such ugly hack is required to workaround this problem: (let* ((orig-window (catch 'live (walk-window-subtree (lambda (window) (when (window-live-p window) (throw 'live window))) (frame-root-window (selected-frame))))) (orig-window-state (window-state-get (frame-root-window (selected-frame)) 'writable))) ;; Hack alert! Create a new window (delete-other-windows) (split-window) (delete-window) (window-state-put orig-window-state (frame-root-window (selected-frame)) 'safe) (eq orig-window (catch 'live (walk-window-subtree (lambda (window) (when (window-live-p window) (throw 'live window))) (frame-root-window (selected-frame)))))) correctly returns nil. > Just that under the hood 'window-state-put' will do the > 'delete-other-windows' then. Now I see the root of this problem: it's because 'delete-other-windows' keeps one window and reuses it for the restored state. So a proper fix for 'window-state-put' should use a cloned window like you proposed.