GNU bug report logs - #42872
[PATCH] Add all-frames as arg for count windows.

Previous Next

Package: emacs;

Reported by: Jen-Chieh Shen <jcs090218 <at> gmail.com>

Date: Sat, 15 Aug 2020 15:14:01 UTC

Severity: normal

Tags: fixed, moreinfo, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42872 in the body.
You can then email your comments to 42872 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#42872; Package emacs. (Sat, 15 Aug 2020 15:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jen-Chieh Shen <jcs090218 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 15 Aug 2020 15:14:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jen-Chieh Shen <jcs090218 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Add all-frames as arg for count windows.
Date: Sat, 15 Aug 2020 16:03:46 +0800
[Message part 1 (text/plain, inline)]
Hi,

I think it is handy to have `all-frames` as an argument when using the
`count-windows` function?

Best,

Jen-Chieh Shen
[Message part 2 (text/html, inline)]
[cnt-win-frames.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42872; Package emacs. (Sun, 16 Aug 2020 12:29:02 GMT) Full text and rfc822 format available.

Message #8 received at 42872 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jen-Chieh Shen <jcs090218 <at> gmail.com>
Cc: 42872 <at> debbugs.gnu.org
Subject: Re: bug#42872: [PATCH] Add all-frames as arg for count windows.
Date: Sun, 16 Aug 2020 14:28:26 +0200
Jen-Chieh Shen <jcs090218 <at> gmail.com> writes:

> I think it is handy to have `all-frames` as an argument when using the
> `count-windows` function?

Sounds like a good addition.

>  (defun count-windows (&optional minibuf)
>     "Return the number of live windows on the selected frame.
> +
>  The optional argument MINIBUF specifies whether the minibuffer
> -window shall be counted.  See `walk-windows' for the precise
> -meaning of this argument."
> +window shall be counted.  
> +
> +The optional argument ALL-FRAMES counted all windows instead of
> +just the selected frame.
> +
> +See `walk-windows' for the precise meaning of this argument."

But your patch doesn't actually add this -- it just changes the doc string?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 16 Aug 2020 12:34:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42872; Package emacs. (Sun, 16 Aug 2020 14:44:02 GMT) Full text and rfc822 format available.

Message #13 received at 42872 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Jen-Chieh Shen <jcs090218 <at> gmail.com>
Cc: 42872 <at> debbugs.gnu.org
Subject: RE: bug#42872: [PATCH] Add all-frames as arg for count windows.
Date: Sun, 16 Aug 2020 07:43:50 -0700 (PDT)
+1 to adding optional arg ALL-FRAMES.

Its behavior should be the same as for `walk-windows',
which `count-windows' uses.  This is also the same as
for `get-buffer-window'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42872; Package emacs. (Sun, 16 Aug 2020 14:51:01 GMT) Full text and rfc822 format available.

Message #16 received at 42872 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Jen-Chieh Shen <jcs090218 <at> gmail.com>
Cc: 42872 <at> debbugs.gnu.org
Subject: RE: bug#42872: [PATCH] Add all-frames as arg for count windows.
Date: Sun, 16 Aug 2020 07:50:15 -0700 (PDT)
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))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42872; Package emacs. (Sun, 16 Aug 2020 20:37:02 GMT) Full text and rfc822 format available.

Message #19 received at 42872 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jen-Chieh Shen <jcs090218 <at> gmail.com>
Cc: 42872 <at> debbugs.gnu.org
Subject: Re: bug#42872: [PATCH] Add all-frames as arg for count windows.
Date: Sun, 16 Aug 2020 22:36:10 +0200
(Please keep the debbugs address in the Cc header.)

Jen-Chieh Shen <jcs090218 <at> gmail.com> writes:

> Oops, I guess I mess it up somehow.
>
> Here is the updated patch!

[...]

>  (defun count-windows (&optional minibuf)
>     "Return the number of live windows on the selected frame.
> +
>  The optional argument MINIBUF specifies whether the minibuffer
> -window shall be counted.  See `walk-windows' for the precise
> -meaning of this argument."

There's still no actual all-frames parameter in the count-windows
function signature.  :-)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42872; Package emacs. (Tue, 18 Aug 2020 13:29:01 GMT) Full text and rfc822 format available.

Message #22 received at 42872 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Jen-Chieh Shen <jcs090218 <at> gmail.com>, 42872 <at> debbugs.gnu.org
Subject: Re: bug#42872: [PATCH] Add all-frames as arg for count windows.
Date: Tue, 18 Aug 2020 15:27:49 +0200
Drew Adams <drew.adams <at> oracle.com> writes:

> +1 to adding optional arg ALL-FRAMES.
>
> Its behavior should be the same as for `walk-windows',
> which `count-windows' uses.  This is also the same as
> for `get-buffer-window'.

Yup, it just passes the argument to window-list-1, which has the same
semantics for that parameter, as far as I can see.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42872; Package emacs. (Tue, 18 Aug 2020 13:30:03 GMT) Full text and rfc822 format available.

Message #25 received at 42872 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Jen-Chieh Shen <jcs090218 <at> gmail.com>, 42872 <at> debbugs.gnu.org
Subject: Re: bug#42872: [PATCH] Add all-frames as arg for count windows.
Date: Tue, 18 Aug 2020 15:29:06 +0200
Drew Adams <drew.adams <at> oracle.com> writes:

> 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.

Hm...  I don't quite see the use case for that.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 18 Aug 2020 13:30:04 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 42872 <at> debbugs.gnu.org and Jen-Chieh Shen <jcs090218 <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 18 Aug 2020 13:30:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 16 Sep 2020 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.