unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: 34656-done@debbugs.gnu.org
Subject: bug#34656: 27.0.50; Directional window swap states
Date: Wed, 27 Feb 2019 23:12:16 +0200	[thread overview]
Message-ID: <871s3tuea7.fsf@mail.linkov.net> (raw)
In-Reply-To: <5C750273.5040607@gmx.at> (martin rudalics's message of "Tue, 26 Feb 2019 10:10:11 +0100")

> +  (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.





      reply	other threads:[~2019-02-27 21:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-25 20:51 bug#34656: 27.0.50; Directional window swap states Juri Linkov
2019-02-26  9:10 ` martin rudalics
2019-02-27 21:12   ` Juri Linkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871s3tuea7.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=34656-done@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).