(window-list) returns a list of visible windows. Is it possible to get this list sorted from the most recently active window to the least?


Found a solution by digging into get-mru-window, which uses window-use-time:

(sort (window-list)
      (lambda (a b) (> (window-use-time a)
                       (window-use-time b))))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.