From: Juri Linkov <juri@linkov.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>, 35385@debbugs.gnu.org
Subject: bug#35385: 27.0.50; Make dired-dwim-target aware of other frames
Date: Thu, 19 Sep 2019 00:48:30 +0300 [thread overview]
Message-ID: <87impp1djl.fsf@mail.linkov.net> (raw)
In-Reply-To: <877e67x6ny.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 17 Sep 2019 00:39:13 +0300")
[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]
> I'd like to elaborate on my comments: the thought was that instead of
> extending the scope of the search for the first random Dired window
> from the selected frame to all frames, would it be better to improve the
> heuristic of finding the window that the user really meant to use
> (remember that the user option name contains the word "DWIM").
>
> The proposed heuristic was to use `get-mru-window' to get
> the most recently used window from all frames, and even
> better way is to traverse all windows ordered by their visiting
> recency on all frames to find the window with Dired mode buffer.
I can't find an existing function that would sort windows by recency,
but fortunately the implementation is straightforward:
(sort (window-list-1)
(lambda (a b)
(> (window-use-time a)
(window-use-time b))))
using `>' gives the mru order, `<' - lru order.
BTW, while looking at windows walking functions, I noticed
an opportunity for simplification.
Martin, could you please confirm if I'm not mistaken with this patch:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: walk-windows-simplify.patch --]
[-- Type: text/x-diff, Size: 1357 bytes --]
diff --git a/lisp/window.el b/lisp/window.el
index cf733153b8..aedebd9d46 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2217,6 +2217,10 @@ walk-windows
- A frame means consider all windows on that frame only.
+If ALL-FRAMES specifies a frame, the first window walked is the
+first window on that frame (the one returned by `frame-first-window'),
+not necessarily the selected window.
+
Anything else means consider all windows on the selected frame
and no others.
@@ -2226,14 +2230,11 @@ walk-windows
;; back to it.
(when (window-minibuffer-p)
(setq minibuf t))
- ;; Make sure to not mess up the order of recently selected
- ;; windows. Use `save-selected-window' and `select-window'
- ;; with second argument non-nil for this purpose.
- (save-selected-window
- (when (framep all-frames)
- (select-window (frame-first-window all-frames) 'norecord))
- (dolist (walk-windows-window (window-list-1 nil minibuf all-frames))
- (funcall fun walk-windows-window))))
+ (dolist (walk-windows-window
+ (window-list-1 (and (framep all-frames)
+ (frame-first-window all-frames))
+ minibuf all-frames))
+ (funcall fun walk-windows-window)))
(defun window-at-side-p (&optional window side)
"Return t if WINDOW is at SIDE of its containing frame.
next prev parent reply other threads:[~2019-09-18 21:48 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-22 21:47 bug#35385: 27.0.50; Make dired-dwim-target aware of other frames Basil L. Contovounesios
2019-04-22 22:11 ` Basil L. Contovounesios
2019-04-29 20:28 ` Juri Linkov
2019-06-23 17:28 ` Lars Ingebrigtsen
2019-09-16 21:11 ` Lars Ingebrigtsen
2019-09-16 21:39 ` Juri Linkov
2019-09-18 21:48 ` Juri Linkov [this message]
2019-09-19 8:18 ` martin rudalics
2019-09-19 20:43 ` Juri Linkov
2019-10-26 23:20 ` Juri Linkov
2019-11-04 19:01 ` Michael Heerdegen
2019-11-05 22:18 ` Juri Linkov
2019-11-08 19:13 ` Michael Heerdegen
2019-11-10 20:38 ` Juri Linkov
2019-11-12 21:21 ` Juri Linkov
2019-11-13 15:30 ` Michael Heerdegen
2019-11-13 21:41 ` Juri Linkov
2019-11-14 15:08 ` Michael Heerdegen
2019-11-14 23:10 ` Juri Linkov
2019-11-15 12:16 ` Michael Heerdegen
2019-11-16 22:06 ` Juri Linkov
2019-11-16 22:42 ` Michael Heerdegen
2020-08-10 11:36 ` Lars Ingebrigtsen
2019-11-14 10:13 ` Eli Zaretskii
2019-11-14 23:07 ` Juri Linkov
2019-09-19 1:51 ` Basil L. Contovounesios
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87impp1djl.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=35385@debbugs.gnu.org \
--cc=contovob@tcd.ie \
--cc=larsi@gnus.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.