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.