From: Drew Adams <drew.adams@oracle.com>
To: Lars Ingebrigtsen <larsi@gnus.org>, Jen-Chieh Shen <jcs090218@gmail.com>
Cc: 42872@debbugs.gnu.org
Subject: bug#42872: [PATCH] Add all-frames as arg for count windows.
Date: Sun, 16 Aug 2020 07:50:15 -0700 (PDT) [thread overview]
Message-ID: <26ea8566-867b-4cc0-9499-cbe0b5ce0934@default> (raw)
In-Reply-To: <1f1a9efc-6961-4dd4-91ba-e8529dcb8465@default>
In addition, you might consider this improvement, for
the current-frame behavior (which should remain the
default behavior): use arg MINIBUF only if the current
frame has a minibuffer.
I've had that in my version of `count-windows' since
1996, if not before that. This is the code I have:
(defun count-windows (&optional minibuf)
"Return the number of visible windows in selected frame.
Optional arg MINIBUF is used only if selected frame has a minibuffer.
MINIBUF = t means count the minibuffer window even if *not* active.
MINIBUF = nil or omitted means count the minibuffer iff it is active.
If MINIBUF is neither t nor nil it means not to count the minibuffer
even if it is active. (See function `walk-windows'.)"
(let ((count 0))
(walk-windows
(function (lambda (w) (setq count (+ count 1))))
(and (memq (cdr (assoc 'minibuffer (frame-parameters)))
'(only t)) ; If this frame has a minibuffer,
minibuf)) ; pass the arg. (Else pass nil.)
count))
next prev parent reply other threads:[~2020-08-16 14:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-15 8:03 bug#42872: [PATCH] Add all-frames as arg for count windows Jen-Chieh Shen
2020-08-16 12:28 ` Lars Ingebrigtsen
2020-08-16 14:43 ` Drew Adams
2020-08-16 14:50 ` Drew Adams [this message]
2020-08-18 13:29 ` Lars Ingebrigtsen
2020-08-18 13:27 ` Lars Ingebrigtsen
[not found] ` <CAMiGhTMRTtxQRQgiok55OuoAHiqz-=BfZQOJFVG+fPASO-TsEA@mail.gmail.com>
2020-08-16 20:36 ` Lars Ingebrigtsen
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=26ea8566-867b-4cc0-9499-cbe0b5ce0934@default \
--to=drew.adams@oracle.com \
--cc=42872@debbugs.gnu.org \
--cc=jcs090218@gmail.com \
--cc=larsi@gnus.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).