Subject: bug#47781: 28.0.50; (window-list-1 nil t) returns nil when minibuffer is inactive

From: Alan Mackenzie <[email-masked]>
Date: Fri, 16 Apr 2021 17:48:56 +0000

Hello, Marmot-Te.

On Thu, Apr 15, 2021 at 00:11:34 +0000, marmot-te wrote:

> Hi,

> I read from the docstring of the function
> > MINIBUF t means consider the minibuffer window even if the 
> > minibuffer is not active

> However, 
> with emacs -Q
> and the minibuffer inactive

> (window-list-1 nil t)
> ;; => nil

> I think this is related to this build since I cannot reproduce 
> with emacs 26.1 (in this case it returns the list of windows, 
> minibuffer included, as expected).

> In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
> 3.24.5, cairo version 1.16.0)
>  of 2021-02-09 built on debian-10-gccemacs
> Repository revision: 1f626e9662d8120acd5a937f847123cc2b8c6e31
> Repository branch: native-comp
> Windowing system distributor 'The X.Org Foundation', version 
> 11.0.12004000
> System Description: Debian GNU/Linux 10 (buster)

[ .... ]

I think the following patch, to .../src/window.c, fixes it:

diff --git a/src/window.c b/src/window.c
index caf9df6c13..23eb802950 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2633,7 +2633,8 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow,
     candidate_p = ((EQ (XWINDOW (all_frames)->frame, w->frame)
                     || (EQ (f->minibuffer_window, all_frames)
                         && EQ (XWINDOW (all_frames)->frame, FRAME_FOCUS_FRAME (f))))
-                   && !is_minibuffer (0, XWINDOW (all_frames)->contents));
+                   && (EQ (minibuf, Qt)
+		       || !is_minibuffer (0, XWINDOW (all_frames)->contents)));
   else if (FRAMEP (all_frames))
     candidate_p = EQ (all_frames, w->frame);
 
..  Please feel free to try it out, and let us know how well it works.
Thanks!

> -- 
> <:3nn~~
>    <:3nn~~
>       <:3nn~~

-- 
Alan Mackenzie (Nuremberg, Germany).