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

From: Drew Adams <[email-masked]>
Date: Sat, 22 Aug 2015 10:23:22 -0700 (PDT)

> >> `get-buffer-window-list' is in window.el.  Couldn't you try
> >> giving it a fourth argument, say SORT, which, if `lru-first'
> >> or `mru-first', would cause it to return the windows in the 
> >> corresponding order?
> >
> > Patch attached.
> 
> FWIW, I think adding an argument for that is a bad idea.  If the
> caller needs the windows sorted in a particular way, then *he*
> should sort them.

(S?he should know whether the return value of `get-buffer-window-list'
is a new list (it is), so that `sort' can be applied to it without
causing problems elsewhere.  For that, s?he will want to consult the
code of `get-buffer-window-list'.)

> It would make sense to provide sorting directly in the function if
> the sorting can't be done, or not as efficiently, after the fact.
> But that is not the case here.

I don't disagree.  What was not obvious was how you might sort
windows wrt last-use time.  But IIUC, Martin has now updated the
manual to mention `window-use-time', of which I was unaware.

What I suggested was not to add a SORT arg to `get-buffer-window-list'
but to add functions such as `(mru|lru)-window-for-buffer'.  (It was
for the latter that I was interested in `get-buffer-window-list'.)