From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 25 16:14:02 2019 Received: (at submit) by debbugs.gnu.org; 25 Feb 2019 21:14:02 +0000 Received: from localhost ([127.0.0.1]:51802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gyNZZ-0005A7-Ro for submit@debbugs.gnu.org; Mon, 25 Feb 2019 16:14:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50341) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gyNZY-00059e-NK for submit@debbugs.gnu.org; Mon, 25 Feb 2019 16:14:01 -0500 Received: from lists.gnu.org ([209.51.188.17]:58157) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyNZN-000348-GX for submit@debbugs.gnu.org; Mon, 25 Feb 2019 16:13:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyNZM-0002by-9k for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2019 16:13:49 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE, RCVD_IN_RP_RNBL,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyNZH-0002sJ-Ca for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2019 16:13:47 -0500 Received: from bisque.maple.relay.mailchannels.net ([23.83.214.18]:53315) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyNZ7-0001tg-Nz for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2019 16:13:38 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3B89E50267E for ; Mon, 25 Feb 2019 21:13:11 +0000 (UTC) Received: from pdx1-sub0-mail-a54.g.dreamhost.com (unknown [100.96.28.213]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id F03FA50327C for ; Mon, 25 Feb 2019 21:13:10 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a54.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); Mon, 25 Feb 2019 21:13:11 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Lonely-Stop: 173a8d4374906e10_1551129191111_1695841162 X-MC-Loop-Signature: 1551129191111:2871958990 X-MC-Ingress-Time: 1551129191111 Received: from pdx1-sub0-mail-a54.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTP id 8C6E381A6A for ; Mon, 25 Feb 2019 13:13:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=1kcWpQyjK6OA6V3rQ3nX5N48Vlg=; b=ocBWcYbwNYYsUCbaa MCrMiRpWnq9ZWCwLrJfrALEaBC54866OjnZPGvAvWgGiUJJ9GGQFcHmbp3ZbCRR5 LIs1JkMD3DyqKWjkawV6c2JUJs+dKdQgd2MSLUpmBh2qTOOd+xYWmg4lWreUvkL6 ESjOvWU6vvpEC8VNCyPCXcn/hQ= 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-a54.g.dreamhost.com (Postfix) with ESMTPSA id 3E8A881A6B for ; Mon, 25 Feb 2019 13:13:08 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a54 From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: 27.0.50; Directional window swap states Organization: LINKOV.NET Date: Mon, 25 Feb 2019 22:51:06 +0200 Message-ID: <87imx7egn9.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrudejgddugeekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohffkfgfgggtsehmtderredtreejnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledrleekrddutdefnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledrleekrddutdefpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 23.83.214.18 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Tags: patch Severity: wishlist Now we have a useful command =E2=80=98window-swap-states=E2=80=99 whose o= nly drawback is that it operates on a random window, i.e. a next window in some mystic cyclic = ordering whose logic I've never been able to understand. To simplify its logic, windmove could be extended to support directional = swapping where the user can point at the window whose state should be swapped with the selected window. As a funny effect, when windows are arranged as 4x4 square tiles, e.g. (window-state-put '(() hc (vc (leaf (buffer "1")) (leaf (buffer "5")) (leaf (buffer "9")) (leaf (buffer "13"))) (vc (leaf (buffer "2")) (leaf (buffer "6")) (leaf (buffer "10")) (leaf (buffer "14"))) (vc (leaf (buffer "3")) (leaf (buffer "7")) (leaf (buffer "11")) (leaf (buffer "15"))) (vc (leaf (buffer "4")) (leaf (buffer "8")) (leaf (buffer "12")) (leaf (buffer " ")))) (frame-root-window)) sliding them has the same feeling like solving the 15 puzzle :) --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=windmove-swap-states.patch diff --git a/lisp/windmove.el b/lisp/windmove.el index 65270d9bbe..e2422a7df4 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -750,6 +752,60 @@ windmove-delete-default-keybindings (global-set-key (vector prefix (append modifiers '(up))) 'windmove-delete-up) (global-set-key (vector prefix (append modifiers '(down))) 'windmove-delete-down)) + +;;; Directional window swap states + +(defun windmove-swap-states-in-direction (dir) + "Swap the states of the selected window and the window at direction DIR. +When `windmove-wrap-around' is non-nil, takes the window +from the opposite side of the frame." + (let ((other-window (window-in-direction dir nil nil nil + windmove-wrap-around t))) + (cond ((null other-window) + (user-error "No window %s from selected window" dir)) + (t + (window-swap-states nil other-window))))) + +;;;###autoload +(defun windmove-swap-states-left () + "Swap the states with the window on the left from the current one." + (interactive) + (windmove-swap-states-in-direction 'left)) + +;;;###autoload +(defun windmove-swap-states-up () + "Swap the states with the window above from the current one." + (interactive) + (windmove-swap-states-in-direction 'up)) + +;;;###autoload +(defun windmove-swap-states-down () + "Swap the states with the window below from the current one." + (interactive) + (windmove-swap-states-in-direction 'down)) + +;;;###autoload +(defun windmove-swap-states-right () + "Swap the states with the window on the right from the current one." + (interactive) + (windmove-swap-states-in-direction 'right)) + +;;;###autoload +(defun windmove-swap-states-default-keybindings (&optional modifiers) + "Set up keybindings for directional window swap states. +Keys are bound to commands that swap the states of the selected window +with the window in the specified direction. Keybindings are of the form +MODIFIERS-{left,right,up,down}, where MODIFIERS is either a list of modifiers +or a single modifier. Default value of MODIFIERS is `shift-super'." + (interactive) + (unless modifiers (setq modifiers '(shift super))) + (unless (listp modifiers) (setq modifiers (list modifiers))) + (global-set-key (vector (append modifiers '(left))) 'windmove-swap-states-left) + (global-set-key (vector (append modifiers '(right))) 'windmove-swap-states-right) + (global-set-key (vector (append modifiers '(up))) 'windmove-swap-states-up) + (global-set-key (vector (append modifiers '(down))) 'windmove-swap-states-down)) + + (provide 'windmove) ;;; windmove.el ends here --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 26 04:10:29 2019 Received: (at 34656) by debbugs.gnu.org; 26 Feb 2019 09:10:29 +0000 Received: from localhost ([127.0.0.1]:52259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gyYku-0001s1-Hq for submit@debbugs.gnu.org; Tue, 26 Feb 2019 04:10:28 -0500 Received: from mout.gmx.net ([212.227.15.18]:43039) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gyYks-0001rm-RP for 34656@debbugs.gnu.org; Tue, 26 Feb 2019 04:10:27 -0500 Received: from [192.168.1.101] ([212.95.5.182]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LZhsq-1hQF7d0TXw-00lWIq; Tue, 26 Feb 2019 10:10:17 +0100 Message-ID: <5C750273.5040607@gmx.at> Date: Tue, 26 Feb 2019 10:10:11 +0100 From: martin rudalics MIME-Version: 1.0 To: Juri Linkov , 34656@debbugs.gnu.org Subject: Re: bug#34656: 27.0.50; Directional window swap states References: <87imx7egn9.fsf@mail.linkov.net> In-Reply-To: <87imx7egn9.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:ZNZdV1TSxKTS1PxIRuOEo9Y5wsRNn2WzUmQo3VKV//2c7sjLyjf 3vzFVEsv6ysX2ECjeXNcyFwfuMbiP7800H9uXdK2CV7VTnDEkAC5OHlrtwu4TZmoCkpIDri N2tDodLQjXERj2UuQMwjBk7NYxNMhPyB4CvRQHxaIUFPyjWlgzCw2BH9eIoshCpEJr1DoNc /khnO1d7ebQgyY+pgo9fg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:v1Cn9ivKkKg=:80vO4r5LKMFezjsbvpNe3Q qdnt1aJCUUPv6AbLY99/lVptQMpbhQk1OiYhADdpO3vzhbeCX3O9MYv0KLgjeulZEHoPf1di/ kOmXaSSWnQLLkQ3EVxTug9CH9QM+Uev+tXVCjnWJuvYN1krrMdAk2vHPOPThu/hVCghbCJNrs i8ytCBviT6kz8Ie49Tf7EU44AxgAr8o93Cd3lNWCrNBd34kc2eJPvXtL/ah77HMpWmTPcWZ4x GX6/t3gY2d3cwXIdvvvswPXuBlkRb22JjhjJ421f341/rYdJ18JOTyIzeUSFYJeFhexWCOi0y jxU5xqLRzYSbzt88LJxEoNlWPi8GgG4rLVMldh6mrtB2xPJjVabpqi4J8S+bZ4+vSFgFZ/bnn yPW9ZlRQdJXOU6j2mdUCc/9WSmGHR+t9ZKnS50DA7/qUi9OeNgJntXXJhPtxNMzNd5oleOnn+ Dgc54vWLc0RNYz7z7C1nIysa13Ox2wHvKcK2Np/etaRSUXenBKTu0AuWA6icNcacHCZR9qf2V boHeCY/n9NzsTAaPqw/17oWNDLeWaubnn4Ixyf1b/bqy/d6Vnv6fBSPO9e6VINJxxty30uSrt PHeRq53lwnY8TmkriBJy5z44BL1Nf2nTu4d6Lf/oUIgwgZJReWn2pU5oAROsuXOwArUWmwyhy EhchX0lfsK3PDi0kXkLy07N068I5PiZtPdjjEyqXN91Z9JfS0jNvyoOsgc6Wr3n7Bkyiw1dwP crRdIansiZXutRZ/PNRUC7anAMICNtHTTpgID7gmmZUINx+oPz7SVKE739nhaGB489JOi+uvS cfkRLN0cuV5uS7HggT92zJPB/cjOWfmHxsiFx1ptqLKmY3QHziQPEB6nZIM/8lSknUbVksk1Y 6RV+4WeiDBDQjr5w1x8Ns8ghyaxoEQhbEG6hYme7olayTvOpwt6gZkBD1u3egCxkQruvo651m OvAgz5RvW5A== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 34656 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) + (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? martin From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 27 16:13:16 2019 Received: (at 34656-done) by debbugs.gnu.org; 27 Feb 2019 21:13:16 +0000 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 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 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) 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 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 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= 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 From: Juri Linkov To: martin rudalics Subject: Re: bug#34656: 27.0.50; Directional window swap states Organization: LINKOV.NET References: <87imx7egn9.fsf@mail.linkov.net> <5C750273.5040607@gmx.at> Date: Wed, 27 Feb 2019 23:12:16 +0200 In-Reply-To: <5C750273.5040607@gmx.at> (martin rudalics's message of "Tue, 26 Feb 2019 10:10:11 +0100") Message-ID: <871s3tuea7.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrvddugddugeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrdelkedruddtfeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrdelkedruddtfedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehruhgurghlihgtshesghhmgidrrghtnecuvehluhhsthgvrhfuihiivgeptd X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34656-done Cc: 34656-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > + (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. From unknown Wed Jun 18 23:12:57 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 28 Mar 2019 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator