all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#47766: 28.0.50; choose-completion fails
@ 2021-04-14  5:03 Madhu
  2021-04-14  8:43 ` Gregory Heytings
  0 siblings, 1 reply; 11+ messages in thread
From: Madhu @ 2021-04-14  5:03 UTC (permalink / raw)
  To: 47766

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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#47766: 28.0.50; choose-completion fails
  2021-04-14  5:03 bug#47766: 28.0.50; choose-completion fails Madhu
@ 2021-04-14  8:43 ` Gregory Heytings
  2021-04-20 13:25   ` Stefan Kangas
  0 siblings, 1 reply; 11+ messages in thread
From: Gregory Heytings @ 2021-04-14  8:43 UTC (permalink / raw)
  To: Madhu; +Cc: 47766


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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#47766: 28.0.50; choose-completion fails
  2021-04-14  8:43 ` Gregory Heytings
@ 2021-04-20 13:25   ` Stefan Kangas
  2021-04-21 13:54     ` Alan Mackenzie
  2021-04-22 15:07     ` Alan Mackenzie
  0 siblings, 2 replies; 11+ messages in thread
From: Stefan Kangas @ 2021-04-20 13:25 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: Alan Mackenzie, Madhu, 47766

Gregory Heytings <gregory@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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#47766: 28.0.50; choose-completion fails
  2021-04-20 13:25   ` Stefan Kangas
@ 2021-04-21 13:54     ` Alan Mackenzie
  2021-04-22 15:07     ` Alan Mackenzie
  1 sibling, 0 replies; 11+ messages in thread
From: Alan Mackenzie @ 2021-04-21 13:54 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Gregory Heytings, Madhu, 47766

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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#47766: 28.0.50; choose-completion fails
  2021-04-20 13:25   ` Stefan Kangas
  2021-04-21 13:54     ` Alan Mackenzie
@ 2021-04-22 15:07     ` Alan Mackenzie
  2021-04-22 16:04       ` Madhu
  1 sibling, 1 reply; 11+ messages in thread
From: Alan Mackenzie @ 2021-04-22 15:07 UTC (permalink / raw)
  To: Madhu, Stefan Kangas; +Cc: Gregory Heytings, 47766

Hello, Madhu and Stefan.

On Tue, Apr 20, 2021 at 08:25:13 -0500, Stefan Kangas wrote:
> Gregory Heytings <gregory@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).





^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#47766: 28.0.50; choose-completion fails
  2021-04-22 15:07     ` Alan Mackenzie
@ 2021-04-22 16:04       ` Madhu
  2021-05-05 15:33         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Madhu @ 2021-04-22 16:04 UTC (permalink / raw)
  To: acm; +Cc: gregory, stefan, 47766

*  Alan Mackenzie <acm@muc.de> <YIGRQ29+yuasRia4@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.]





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#47766: 28.0.50; choose-completion fails
  2021-04-22 16:04       ` Madhu
@ 2021-05-05 15:33         ` Lars Ingebrigtsen
  2021-05-06  2:46           ` Madhu
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-05 15:33 UTC (permalink / raw)
  To: Madhu; +Cc: acm, gregory, stefan, 47766

Madhu <enometh@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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#47766: 28.0.50; choose-completion fails
  2021-05-05 15:33         ` Lars Ingebrigtsen
@ 2021-05-06  2:46           ` Madhu
  2021-05-06  8:33             ` Lars Ingebrigtsen
  2021-05-06 10:59             ` Alan Mackenzie
  0 siblings, 2 replies; 11+ messages in thread
From: Madhu @ 2021-05-06  2:46 UTC (permalink / raw)
  To: larsi; +Cc: acm, gregory, stefan, 47766

*  Lars Ingebrigtsen <larsi@gnus.org> <87a6p942l9.fsf@gnus.org>
Wrote on Wed, 05 May 2021 17:33:54 +0200
> Madhu <enometh@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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#47766: 28.0.50; choose-completion fails
  2021-05-06  2:46           ` Madhu
@ 2021-05-06  8:33             ` Lars Ingebrigtsen
  2021-05-06  9:55               ` Alan Mackenzie
  2021-05-06 10:59             ` Alan Mackenzie
  1 sibling, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-06  8:33 UTC (permalink / raw)
  To: Madhu; +Cc: acm, gregory, stefan, 47766

Madhu <enometh@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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#47766: 28.0.50; choose-completion fails
  2021-05-06  8:33             ` Lars Ingebrigtsen
@ 2021-05-06  9:55               ` Alan Mackenzie
  0 siblings, 0 replies; 11+ messages in thread
From: Alan Mackenzie @ 2021-05-06  9:55 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Madhu, stefan, gregory, 47766

Hello, Lars.

On Thu, May 06, 2021 at 10:33:12 +0200, Lars Ingebrigtsen wrote:
> Madhu <enometh@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).





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#47766: 28.0.50; choose-completion fails
  2021-05-06  2:46           ` Madhu
  2021-05-06  8:33             ` Lars Ingebrigtsen
@ 2021-05-06 10:59             ` Alan Mackenzie
  1 sibling, 0 replies; 11+ messages in thread
From: Alan Mackenzie @ 2021-05-06 10:59 UTC (permalink / raw)
  To: Madhu; +Cc: acm, larsi, stefan, gregory, 47766-done

Hello, Madhu.

On Thu, May 06, 2021 at 08:16:39 +0530, Madhu wrote:
> *  Lars Ingebrigtsen <larsi@gnus.org> <87a6p942l9.fsf@gnus.org>
> Wrote on Wed, 05 May 2021 17:33:54 +0200
> > Madhu <enometh@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).





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-05-06 10:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-14  5:03 bug#47766: 28.0.50; choose-completion fails Madhu
2021-04-14  8:43 ` Gregory Heytings
2021-04-20 13:25   ` Stefan Kangas
2021-04-21 13:54     ` Alan Mackenzie
2021-04-22 15:07     ` Alan Mackenzie
2021-04-22 16:04       ` Madhu
2021-05-05 15:33         ` Lars Ingebrigtsen
2021-05-06  2:46           ` Madhu
2021-05-06  8:33             ` Lars Ingebrigtsen
2021-05-06  9:55               ` Alan Mackenzie
2021-05-06 10:59             ` Alan Mackenzie

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.