From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#34656: 27.0.50; Directional window swap states Date: Wed, 27 Feb 2019 23:12:16 +0200 Organization: LINKOV.NET Message-ID: <871s3tuea7.fsf@mail.linkov.net> References: <87imx7egn9.fsf@mail.linkov.net> <5C750273.5040607@gmx.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="188967"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 34656-done@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 27 22:14:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gz6Wr-000mz0-Jq for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Feb 2019 22:14:14 +0100 Original-Received: from localhost ([127.0.0.1]:50724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz6Wq-0005Gv-GS for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Feb 2019 16:14:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz6Wk-0005Gm-LI for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2019 16:14:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gz6Wj-0000JD-Sx for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2019 16:14:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40891) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gz6Wi-0000ID-Bh for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2019 16:14:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gz6Wi-00057J-2s for bug-gnu-emacs@gnu.org; Wed, 27 Feb 2019 16:14:04 -0500 Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Feb 2019 21:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 34656 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 34656@debbugs.gnu.org, juri@linkov.net, juri@linkov.net Original-Received: via spool by 34656-done@debbugs.gnu.org id=D34656.155130199619602 (code D ref 34656); Wed, 27 Feb 2019 21:14:02 +0000 Original-Received: (at 34656-done) by debbugs.gnu.org; 27 Feb 2019 21:13:16 +0000 Original-Received: from localhost ([127.0.0.1]:54434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gz6Vu-000564-Ak for submit@debbugs.gnu.org; Wed, 27 Feb 2019 16:13:16 -0500 Original-Received: from purple.birch.relay.mailchannels.net ([23.83.209.150]:56460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gz6Vr-00055v-Ai for 34656-done@debbugs.gnu.org; Wed, 27 Feb 2019 16:13:12 -0500 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 1B1EC50307A; Wed, 27 Feb 2019 21:13:10 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a65.g.dreamhost.com (unknown [100.96.26.217]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id CD0F45011B2; Wed, 27 Feb 2019 21:13:09 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a65.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.3); Wed, 27 Feb 2019 21:13:10 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Little-Stretch: 3b87ee0b406e1838_1551301989977_3033686452 X-MC-Loop-Signature: 1551301989976:2651691767 X-MC-Ingress-Time: 1551301989976 Original-Received: from pdx1-sub0-mail-a65.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a65.g.dreamhost.com (Postfix) with ESMTP id 78CF38199B; Wed, 27 Feb 2019 13:13:09 -0800 (PST) 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=HucElH/HUXsjWKT3j8v5TrdJ09g=; b= SjCKf6sHnZ+daEygsN6hpk5B4qmuWV7DoVzybIYvone50+uOSiFND2MBwX5JQQ57 VPMLDbrSHN9NpIN+jPzwMlSzlFqsFK4drdGFy115wSn0CdGD1s2Fm0Fb+s3y8QFL j7O9mZXi3SEX4B5xc0CSIv5uCk+q7pe1JKJCQdGWVfM= Original-Received: from mail.jurta.org (m91-129-98-103.cust.tele2.ee [91.129.98.103]) (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-a65.g.dreamhost.com (Postfix) with ESMTPSA id 344E581997; Wed, 27 Feb 2019 13:13:06 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a65 In-Reply-To: <5C750273.5040607@gmx.at> (martin rudalics's message of "Tue, 26 Feb 2019 10:10:11 +0100") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrvddugddugeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrdelkedruddtfeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrdelkedruddtfedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehruhgurghlihgtshesghhmgidrrghtnecuvehluhhsthgvrhfuihiivgeptd 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: 209.51.188.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:155882 Archived-At: > + (let ((other-window (window-in-direction dir nil nil nil > + windmove-wrap-around t))) > > If 'windmove-wrap-around' is nil, this may swap the selected window's > state with that of the minibuffer window. Or am I misinterpreting? Thanks for the review. Now I fixed the minibuffer case and closed this request. Before this fix, trying to swap states with the minibuffer failed with the error: (error "Window # too small to accommodate state") Now after the fix, it doesn't consider the minibuffer as a candidate to swap states. BTW, before proposing the implementation in windmove, the first idea was to improve the logic of finding the second window in window-swap-states like: diff --git a/lisp/window.el b/lisp/window.el index 80828bb35c..3961ec3975 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -6018,7 +6018,10 @@ window-swap-states (if window-2 (unless (window-live-p window-2) (error "%s is not a live window" window-2)) - (setq window-2 (next-window window-1 'nomini 'visible))) + (setq window-2 (or (get-mru-window 'visible t t) + (get-mru-window 0 t t) + (get-mru-window t t t) + (next-window window-1 'nomini 'visible)))) (unless (eq window-1 window-2) (let* ((height (memq size '(t height))) (width (memq size '(t width))) This logic is like finding the second window in `compare-windows-get-recent-window'. But since directional swapping in windmove is more convenient, it seems the above change is not needed.