Subject: bug#21305: 25.0.50; `get-buffer-window-list' doc - what order?

From: Drew Adams <[email-masked]>
Date: Fri, 21 Aug 2015 09:32:16 -0700 (PDT)

Sorry for drifting from the bug, but is something like this useful
generally?  I will use it, but I'm thinking others might also.

(defun mru-window-for-buffer (buffer &optional minibuf all-frames)
  "Return the most recently used window for BUFFER.
Optional args MINIBUF and ALL-FRAMES are as for `get-buffer-window-list'."
  (let* ((wins     (get-buffer-window-list buffer minibuf all-frames))
         (mru-win  (car wins)))
    (dolist (win  (cdr wins))
      (unless  (time-less-p win mru-win) (setq mru-win  win)))
    mru-win))

Similary, `lru-window-for-buffer'.