GNU bug report logs - #34656
27.0.50; Directional window swap states

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Mon, 25 Feb 2019 21:14:03 UTC

Severity: wishlist

Tags: patch

Found in version 27.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 34656-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 34656-done <at> debbugs.gnu.org
Subject: Re: bug#34656: 27.0.50; Directional window swap states
Date: Wed, 27 Feb 2019 23:12:16 +0200
> +  (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 #<window 4 on  *Minibuf-0*> 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.




This bug report was last modified 6 years and 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.