Subject: Re: bug#47766: 28.0.50; choose-completion fails

From: Madhu <[email-masked]>
Date: Thu, 22 Apr 2021 21:34:29 +0530 (IST)

*  Alan Mackenzie <[email-masked]> <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.]