unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Arthur Miller <arthur.miller@live.com>, Eli Zaretskii <eliz@gnu.org>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: Make window-list return windows for all frames
Date: Thu, 15 Jun 2023 16:11:52 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488AD29AC38DB41AB4862E9F35BA@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <AM9PR09MB4977118EEF3E8111AB639179965BA@AM9PR09MB4977.eurprd09.prod.outlook.com>

> (defun window-list-by-mode (mode &optional all-frames)
>   (let ((window-list))
>     (walk-windows
>      (lambda (w)
>        (with-current-buffer (window-buffer w)
>          (when (eq major-mode mode)
>            (push (cons (prin1-to-string w) w) window-list))))
>      nil all-frames)
>     window-list))

It's also possible to filter the buffers first.
 
(defun windows-with-mode (mode &optional minibuf all-frames)
  (let ((wins  ()))
    (dolist (buf  (seq-filter
                   (lambda (buf)
                     (with-current-buffer buf
                       (eq major-mode mode)))
                   (buffer-list)))
      (setq wins  (nconc (get-buffer-window-list
                          buf minibuf all-frames)
                         wins)))
    wins))

(windows-with-mode 'Info-mode nil 'visible)

But it's no doubt faster to filter the `window-list',
just as you've done, because there are typically many
buffers that are not displayed.



  parent reply	other threads:[~2023-06-15 16:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 12:41 Make window-list return windows for all frames Arthur Miller
2023-06-15 13:09 ` Eli Zaretskii
2023-06-15 14:01   ` Arthur Miller
2023-06-15 15:22     ` Eli Zaretskii
2023-06-15 16:32       ` Arthur Miller
2023-06-16  7:29         ` Gregory Heytings
2023-06-16 10:03           ` Arthur Miller
2023-06-16 10:34             ` Eli Zaretskii
2023-06-16 14:21               ` martin rudalics
2023-06-17  8:39                 ` Eli Zaretskii
2023-06-17  9:39                   ` martin rudalics
2023-06-17 10:42                     ` Eli Zaretskii
2023-06-18 13:36                       ` Arthur Miller
2023-06-19  6:55                       ` Arthur Miller
2023-06-20  6:25                         ` martin rudalics
2023-06-27 16:44                           ` Arthur Miller
2023-06-15 16:11     ` Drew Adams [this message]
2023-06-15 17:18       ` [External] : " Arthur Miller
2023-06-15 13:12 ` Gregory Heytings
2023-06-15 14:04   ` Arthur Miller
2023-06-15 14:19     ` Gregory Heytings
2023-06-15 16:19       ` Arthur Miller
2023-06-15 17:15         ` Gregory Heytings
2023-06-15 17:53           ` Arthur Miller
2023-06-15 13:50 ` Po Lu
2023-06-15 18:02   ` Arthur Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB5488AD29AC38DB41AB4862E9F35BA@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=arthur.miller@live.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).