I want to get a list of all the windows and their frames, so I can jump directly to the frame and window.

If a buffer is not open in a window then the command should still jump to the last frame in which that buffer was displayed and open a window on the buffer in that frame, else it should open it in a frame designated as the default for opening existing buffers, or the current one if none has been set.

  • My guess is that there are a number of packages that already provide behavior similar to what it is that you seek, and you are reinventing the wheel so to speak. Getting a list as you describe is not sufficient to locate a particular buffer that may be displayed in one or more windows of the desired frame, and then selecting just one of those windows (if such a window exists at all). Please consider editing your question to better describe what it is that you actually want to do, and perhaps provide an example ... – lawlist Nov 1 '20 at 1:38
  • So that the forum participants do not duplicate efforts already made in the reddit/emacs forums, I am providing a link to that thread by this same O.P.: reddit.com/r/emacs/comments/jlitex/… – lawlist Nov 1 '20 at 1:45
  • @lawlist There is a distinction between what one wants to accomplish, and acquiring the necessary technical info to accomplish it if there are packages that do it or are unsatisfactory for your needs. This question is having code that provides the technical info to enable me to accomplish what I need in my own way. The reddit question is about knowing if there is an existing solution for what I want to accomplish. The different titles of the question show the difference. This question is concerned with generating the raw information itself. Moving to the frame itself is secondary – vfclists Nov 1 '20 at 6:53
  • 1
    How about? (mapcar (lambda (frame) (cons frame (list (window-list frame)))) (frame-list)) That will produce a list with elements consisting (FRAME (WINDOWS ....)) – lawlist Nov 1 '20 at 7:21
  • Thanks. How can this be written to print each window on a separate line grouped by frame? – vfclists Nov 1 '20 at 8:51

Your Answer

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

Browse other questions tagged or ask your own question.