2

There's frame-list but this lists child-frames, and there's visible-frame-list but this doesn't list iconified frames.

It seems like there should be a simple function to return all non-child frames.

I suspect it can be hacked together with filtered-frame-list but my elisp-fu is not strong enough to figure it out.

0
1

You just need to filter the frames returned by frame-list selecting only the ones that have a null parent-frame:

(defun non-child-frame-list ()
  (let ((frames (frame-list)))
    (seq-filter
      (lambda (frame)
        (null (cadr (assoc 'parent-frame (frame-parameters frame)))))
      frames)))

You can call it like this ESC ESC : (non-child-frame-list).

Alternatively, as you surmised, you can do it with filtered-frame-list with this predicate:

(defun non-child-frame-p (frame)
   (null (cadr (assoc 'parent-frame (frame-parameters frame)))))

Then you can do (filtered-frame-list #'non-child-frame-p).

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.