> 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: