GNU bug report logs - #47766
28.0.50; choose-completion fails

Previous Next

Package: emacs;

Reported by: Madhu <enometh <at> meer.net>

Date: Wed, 14 Apr 2021 05:04:01 UTC

Severity: normal

Merged with 48229

Found in version 28.0.50

Done: Alan Mackenzie <acm <at> muc.de>

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 47766 in the body.
You can then email your comments to 47766 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#47766; Package emacs. (Wed, 14 Apr 2021 05:04:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Madhu <enometh <at> meer.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 14 Apr 2021 05:04:01 GMT) Full text and rfc822 format available.

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

From: Madhu <enometh <at> meer.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; choose-completion fails
Date: Wed, 14 Apr 2021 10:33:08 +0530 (IST)
In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, Motif Version 2.3.8, cairo version 1.16.0)
 of 2021-04-14 built on maher
based on master 844b8949a71f180d395a237c768b22d91cf91ded
(with the motif revert reverted)

1. emacs -Q -eval '(setq pop-up-windows nil pop-up-frames t)'
2. C-x b TAB

this would pop up a new *Completions* buffer in a new frame
with are two choices *Messages* and *scratch*

3. choose a completion (click or hit enter on one of the choices)

user-error: Cannot switch buffers in minibuffer window




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47766; Package emacs. (Wed, 14 Apr 2021 08:44:01 GMT) Full text and rfc822 format available.

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

From: Gregory Heytings <gregory <at> heytings.org>
To: Madhu <enometh <at> meer.net>
Cc: 47766 <at> debbugs.gnu.org
Subject: Re: bug#47766: 28.0.50; choose-completion fails
Date: Wed, 14 Apr 2021 08:43:29 +0000
>
> In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, Motif Version 2.3.8, 
> cairo version 1.16.0) of 2021-04-14 built on maher based on master 
> 844b8949a71f180d395a237c768b22d91cf91ded (with the motif revert 
> reverted)
>
> 1. emacs -Q -eval '(setq pop-up-windows nil pop-up-frames t)'
> 2. C-x b TAB
>
> this would pop up a new *Completions* buffer in a new frame with are two 
> choices *Messages* and *scratch*
>
> 3. choose a completion (click or hit enter on one of the choices)
>
> user-error: Cannot switch buffers in minibuffer window
>

This is because of commit 7c2ebf6e23.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47766; Package emacs. (Tue, 20 Apr 2021 13:26:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: Alan Mackenzie <acm <at> muc.de>, Madhu <enometh <at> meer.net>,
 47766 <at> debbugs.gnu.org
Subject: Re: bug#47766: 28.0.50; choose-completion fails
Date: Tue, 20 Apr 2021 08:25:13 -0500
Gregory Heytings <gregory <at> heytings.org> writes:

>> In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, Motif Version 2.3.8, cairo
>> version 1.16.0) of 2021-04-14 built on maher based on master
>> 844b8949a71f180d395a237c768b22d91cf91ded (with the motif revert reverted)
>>
>> 1. emacs -Q -eval '(setq pop-up-windows nil pop-up-frames t)'
>> 2. C-x b TAB
>>
>> this would pop up a new *Completions* buffer in a new frame with are two
>> choices *Messages* and *scratch*
>>
>> 3. choose a completion (click or hit enter on one of the choices)
>>
>> user-error: Cannot switch buffers in minibuffer window
>
> This is because of commit 7c2ebf6e23.

Copying in Alan here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47766; Package emacs. (Wed, 21 Apr 2021 13:55:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Gregory Heytings <gregory <at> heytings.org>, Madhu <enometh <at> meer.net>,
 47766 <at> debbugs.gnu.org
Subject: Re: bug#47766: 28.0.50; choose-completion fails
Date: Wed, 21 Apr 2021 13:54:20 +0000
Hello, Madhu.

I've been looking into this bug for several hours, and it may take some
while to fix.  Thanks for taking the trouble to report it.

On Tue, Apr 20, 2021 at 08:25:13 -0500, Stefan Kangas wrote:
> Gregory Heytings <gregory <at> heytings.org> writes:

> >> In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, Motif Version 2.3.8, cairo
> >> version 1.16.0) of 2021-04-14 built on maher based on master
> >> 844b8949a71f180d395a237c768b22d91cf91ded (with the motif revert reverted)

> >> 1. emacs -Q -eval '(setq pop-up-windows nil pop-up-frames t)'
> >> 2. C-x b TAB

> >> this would pop up a new *Completions* buffer in a new frame with are two
> >> choices *Messages* and *scratch*

> >> 3. choose a completion (click or hit enter on one of the choices)

> >> user-error: Cannot switch buffers in minibuffer window

Gregory and Stefan:

> > This is because of commit 7c2ebf6e23.

> Copying in Alan here.

Thanks for drawing my attention towards the bug.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47766; Package emacs. (Thu, 22 Apr 2021 15:08:01 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Madhu <enometh <at> meer.net>, Stefan Kangas <stefan <at> marxist.se>
Cc: Gregory Heytings <gregory <at> heytings.org>, 47766 <at> debbugs.gnu.org
Subject: Re: bug#47766: 28.0.50; choose-completion fails
Date: Thu, 22 Apr 2021 15:07:47 +0000
Hello, Madhu and Stefan.

On Tue, Apr 20, 2021 at 08:25:13 -0500, Stefan Kangas wrote:
> Gregory Heytings <gregory <at> heytings.org> writes:

> >> In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, Motif Version 2.3.8, cairo
> >> version 1.16.0) of 2021-04-14 built on maher based on master
> >> 844b8949a71f180d395a237c768b22d91cf91ded (with the motif revert reverted)

> >> 1. emacs -Q -eval '(setq pop-up-windows nil pop-up-frames t)'
> >> 2. C-x b TAB

> >> this would pop up a new *Completions* buffer in a new frame with are two
> >> choices *Messages* and *scratch*

> >> 3. choose a completion (click or hit enter on one of the choices)

> >> user-error: Cannot switch buffers in minibuffer window

> > This is because of commit 7c2ebf6e23.

Or, more accurately, because the changes in that commit were incomplete.
In particular, functions iconify-frame and make-frame-invisible were
moving minibuffers in a way no longer consistent with the rest of Emacs.

Madhu, would you please try out the following patch (which gives a couple
of harmless warnings in compilation), and tell us whether it fixes the
problems in your setup, or what is still not working properly.  Thanks!



diff --git a/lisp/window.el b/lisp/window.el
index 071761ea50..faf639cddd 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4119,7 +4119,7 @@ window-deletable-p
 		  (let ((minibuf (active-minibuffer-window)))
 		    (and minibuf (eq frame (window-frame minibuf))
                          (not (eq (default-toplevel-value
-                                    minibuffer-follows-selected-frame)
+                                    'minibuffer-follows-selected-frame)
                                   t)))))
 	'frame))
      ((window-minibuffer-p window)
diff --git a/src/frame.c b/src/frame.c
index 097cd555c6..a1a6d58cb6 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2085,9 +2085,10 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
       do_switch_frame (frame1, 0, 1, Qnil);
       sf = SELECTED_FRAME ();
     }
-
-  /* Don't allow minibuf_window to remain on a deleted frame.  */
-  check_minibuf_window (frame, minibuffer_selected);
+  else
+    /* Ensure any minibuffers on FRAME are moved onto the selected
+       frame.  */
+    move_minibuffers_onto_frame (f, true);
 
   /* Don't let echo_area_window to remain on a deleted frame.  */
   if (EQ (f->minibuffer_window, echo_area_window))
@@ -2718,9 +2719,6 @@ DEFUN ("make-frame-invisible", Fmake_frame_invisible, Smake_frame_invisible,
   if (NILP (force) && !other_frames (f, true, false))
     error ("Attempt to make invisible the sole visible or iconified frame");
 
-  /* Don't allow minibuf_window to remain on an invisible frame.  */
-  check_minibuf_window (frame, EQ (minibuf_window, selected_window));
-
   if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->frame_visible_invisible_hook)
     FRAME_TERMINAL (f)->frame_visible_invisible_hook (f, false);
 
@@ -2763,9 +2761,6 @@ DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame,
     }
 #endif	/* HAVE_WINDOW_SYSTEM */
 
-  /* Don't allow minibuf_window to remain on an iconified frame.  */
-  check_minibuf_window (frame, EQ (minibuf_window, selected_window));
-
   if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->iconify_frame_hook)
     FRAME_TERMINAL (f)->iconify_frame_hook (f);
 
diff --git a/src/minibuf.c b/src/minibuf.c
index c4482d7f1e..bc7d439398 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -212,7 +212,23 @@ DEFUN ("active-minibuffer-window", Factive_minibuffer_window,
        doc: /* Return the currently active minibuffer window, or nil if none.  */)
      (void)
 {
-  return minibuf_level ? minibuf_window : Qnil;
+  Lisp_Object frames, frame;
+  struct frame *f;
+  Lisp_Object innermost_MB;
+
+  if (!minibuf_level)
+    return Qnil;
+
+  innermost_MB = nth_minibuffer (minibuf_level);
+  FOR_EACH_FRAME (frames, frame)
+    {
+      f = XFRAME (frame);
+      if (FRAME_LIVE_P (f)
+	  && WINDOW_LIVE_P (f->minibuffer_window)
+	  && EQ (XWINDOW (f->minibuffer_window)->contents, innermost_MB))
+	return f->minibuffer_window;
+    }
+  return minibuf_window;	/* "Can't happen." */
 }
 
 DEFUN ("set-minibuffer-window", Fset_minibuffer_window,


> Copying in Alan here.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47766; Package emacs. (Thu, 22 Apr 2021 16:06:01 GMT) Full text and rfc822 format available.

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

From: Madhu <enometh <at> meer.net>
To: acm <at> muc.de
Cc: gregory <at> heytings.org, stefan <at> marxist.se, 47766 <at> debbugs.gnu.org
Subject: Re: bug#47766: 28.0.50; choose-completion fails
Date: Thu, 22 Apr 2021 21:34:29 +0530 (IST)
*  Alan Mackenzie <acm <at> muc.de> <YIGRQ29+yuasRia4 <at> ACM>
Wrote on Thu, 22 Apr 2021 15:07:47 +0000

> Or, more accurately, because the changes in that commit were incomplete.
> In particular, functions iconify-frame and make-frame-invisible were
> moving minibuffers in a way no longer consistent with the rest of Emacs.
>
> Madhu, would you please try out the following patch (which gives a couple
> of harmless warnings in compilation), and tell us whether it fixes the
> problems in your setup, or what is still not working properly.  Thanks!

Thank you.  I'm running it now and will let you know if i spot
anything.


The rest of this is not directlty related to the bug, but somewhat
related to your post on emacs-devel invisible and iconified windows.
mutter (gnome-shell) and wayland throw some more spanners into the
works - mutter does not have a concept of "iconified" it only has a
notion of "hidden". A hidden window has no "hidden" state as far as
the compositor is concerned. M-TAB/switchers would show previews of
the current state of the window. If an emacs frame iconifies itself
(gtk:gtk_window_iconify) rather than the user causing the compositing
window manager to hide it, it cannot map itself back.

I end up with something like
;; work around gnome-shell error
(defadvice make-frame-visible (around mutter-workaround (&optional frame) activate)
  (if (or (eql (frame-parameter frame 'visibility) 'icon)
	   (eql (frame-parameter frame 'visibility) nil)) ;gnome-shell40.a
      (set-frame-parameter frame 'visibility nil))
  ad-do-it)

to make make-frame-visible work.

[PS. There seem to be some other rough corners - sometimes I end up in
a recursive-edit where one cannot go back to the top-level and have to
quit emacs instead - but i haven't triggered this one in the past week
so i don't have a recipe for it.]




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47766; Package emacs. (Wed, 05 May 2021 15:35:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Madhu <enometh <at> meer.net>
Cc: acm <at> muc.de, gregory <at> heytings.org, stefan <at> marxist.se, 47766 <at> debbugs.gnu.org
Subject: Re: bug#47766: 28.0.50; choose-completion fails
Date: Wed, 05 May 2021 17:33:54 +0200
Madhu <enometh <at> meer.net> writes:

>> Madhu, would you please try out the following patch (which gives a couple
>> of harmless warnings in compilation), and tell us whether it fixes the
>> problems in your setup, or what is still not working properly.  Thanks!
>
> Thank you.  I'm running it now and will let you know if i spot
> anything.

This was almost two weeks ago -- did the patch work well?

-- 
(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. (Wed, 05 May 2021 15:35:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47766; Package emacs. (Thu, 06 May 2021 02:47:01 GMT) Full text and rfc822 format available.

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

From: Madhu <enometh <at> meer.net>
To: larsi <at> gnus.org
Cc: acm <at> muc.de, gregory <at> heytings.org, stefan <at> marxist.se, 47766 <at> debbugs.gnu.org
Subject: Re: bug#47766: 28.0.50; choose-completion fails
Date: Thu, 06 May 2021 08:16:39 +0530 (IST)
*  Lars Ingebrigtsen <larsi <at> gnus.org> <87a6p942l9.fsf <at> gnus.org>
Wrote on Wed, 05 May 2021 17:33:54 +0200
> Madhu <enometh <at> meer.net> writes:
>> Thank you.  I'm running it now and will let you know if i spot
>> anything.
> This was almost two weeks ago -- did the patch work well?

Yes. I haven't seen any problems (though I can't claim to have tested
all the corner cases)
---Madhu




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47766; Package emacs. (Thu, 06 May 2021 08:34:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Madhu <enometh <at> meer.net>
Cc: acm <at> muc.de, gregory <at> heytings.org, stefan <at> marxist.se, 47766 <at> debbugs.gnu.org
Subject: Re: bug#47766: 28.0.50; choose-completion fails
Date: Thu, 06 May 2021 10:33:12 +0200
Madhu <enometh <at> meer.net> writes:

> Yes. I haven't seen any problems (though I can't claim to have tested
> all the corner cases)

OK.  Alan, are you pushing the change, then?  This bit looks odd, though:

--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4119,7 +4119,7 @@ window-deletable-p
 		  (let ((minibuf (active-minibuffer-window)))
 		    (and minibuf (eq frame (window-frame minibuf))
                          (not (eq (default-toplevel-value
-                                    minibuffer-follows-selected-frame)
+                                    'minibuffer-follows-selected-frame)
                                   t)))))


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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47766; Package emacs. (Thu, 06 May 2021 09:56:01 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Madhu <enometh <at> meer.net>, stefan <at> marxist.se, gregory <at> heytings.org,
 47766 <at> debbugs.gnu.org
Subject: Re: bug#47766: 28.0.50; choose-completion fails
Date: Thu, 6 May 2021 09:55:02 +0000
Hello, Lars.

On Thu, May 06, 2021 at 10:33:12 +0200, Lars Ingebrigtsen wrote:
> Madhu <enometh <at> meer.net> writes:

> > Yes. I haven't seen any problems (though I can't claim to have tested
> > all the corner cases)

> OK.  Alan, are you pushing the change, then?

I'll commit the change, yes, soon, hopefully today.

> This bit looks odd, though:

> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -4119,7 +4119,7 @@ window-deletable-p
>  		  (let ((minibuf (active-minibuffer-window)))
>  		    (and minibuf (eq frame (window-frame minibuf))
>                           (not (eq (default-toplevel-value
> -                                    minibuffer-follows-selected-frame)
> +                                    'minibuffer-follows-selected-frame)
>                                    t)))))

Yes, I was hoping nobody would notice that.  ;-)  The quote is
absolutely required for correct functioning.  Missing the quote didn't
throw an error when m-f-s-frame was t or nil (but the whole point of
default-toplevel-value was lost), but did when it was 'hybrid.  With the
commit, the glitch will be fixed forever.

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

-- 
Alan Mackenzie (Nuremberg, Germany).




Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Thu, 06 May 2021 11:00:02 GMT) Full text and rfc822 format available.

Notification sent to Madhu <enometh <at> meer.net>:
bug acknowledged by developer. (Thu, 06 May 2021 11:00:03 GMT) Full text and rfc822 format available.

Message #39 received at 47766-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Madhu <enometh <at> meer.net>
Cc: acm <at> muc.de, larsi <at> gnus.org, stefan <at> marxist.se, gregory <at> heytings.org,
 47766-done <at> debbugs.gnu.org
Subject: Re: bug#47766: 28.0.50; choose-completion fails
Date: Thu, 6 May 2021 10:59:43 +0000
Hello, Madhu.

On Thu, May 06, 2021 at 08:16:39 +0530, Madhu wrote:
> *  Lars Ingebrigtsen <larsi <at> gnus.org> <87a6p942l9.fsf <at> gnus.org>
> Wrote on Wed, 05 May 2021 17:33:54 +0200
> > Madhu <enometh <at> meer.net> writes:
> >> Thank you.  I'm running it now and will let you know if i spot
> >> anything.
> > This was almost two weeks ago -- did the patch work well?

> Yes. I haven't seen any problems (though I can't claim to have tested
> all the corner cases)

Thanks for the testing!  I wouldn't worry about the corner cases too
much.  As far as the minibuffer goes, corner cases constitute a near
infinite set.  ;-(

I'm closing the bug with this post.  If any more problems turn up in
this area, please report them in a new bug.  Thanks!

> ---Madhu

-- 
Alan Mackenzie (Nuremberg, Germany).




Removed tag(s) moreinfo. Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Thu, 06 May 2021 15:19:02 GMT) Full text and rfc822 format available.

Forcibly Merged 47766 48229. Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Thu, 06 May 2021 15:25:02 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. (Fri, 04 Jun 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 325 days ago.

Previous Next


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