[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#34656: 27.0.50; Directional window swap states
From: |
Juri Linkov |
Subject: |
bug#34656: 27.0.50; Directional window swap states |
Date: |
Wed, 27 Feb 2019 23:12:16 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) |
> + (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.