GNU bug report logs - #48674
Frames and minibuffer bug

Previous Next

Package: emacs;

Reported by: Iris García <iris.garcia.desebastian <at> gmail.com>

Date: Wed, 26 May 2021 14:42:04 UTC

Severity: normal

Merged with 48675

Found in version 28.0.50

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 48674 <at> debbugs.gnu.org, Iris García <iris.garcia.desebastian <at> gmail.com>
Subject: bug#48674: Frames and minibuffer bug
Date: Fri, 28 May 2021 10:26:32 +0200
>> Does this mean that the
>
>>     Fselect_window (f->selected_window, norecord);
>
>> in do_switch_frame fails?  If so, why?
>
> For some values of "fails", yes.  When we're in frame F1's minibuffer,
> and do (with-selected-frame F2 (foo)):
> (i) Frame F2 becomes selected.
> (ii) The current window in F1 ceases to be the mini-window, becoming some
> other window.
> (iii) The minibuffer is moved from F1 to F2.
>
> (iv) We evaluate (foo).
>
> (v) Frame F1 becomes selected again.
> (vi) The current window in F1 doesn't revert to being the mini-window.

But why precisely does Fselect_window fail here?

> This is what has preoccupied me over the last few hours.  It seems we
> want do_switch_frame to do different things for (i) a "permanent" frame
> switch (e.g. C-x 5 o) and (i) a "temporary" frame switch (e.g.
> with-selected-frame).  If the selected window in F1 is the mini-window,
> we want it to select a different window in (i), but stay the same in
> (ii).

Be careful in one additional regard: The display engine calls
Fselect_window too for its own purposes.

>> Are we sure that we want to disallow a function on
>> `minibuffer-setup-hook' to change the selected window?  With Emacs 27
>
>
>> (defun foo ()
>>     (select-window (frame-first-window)))
>
>> (add-hook 'minibuffer-setup-hook 'foo)
>
>
>> works without any problems here.
>
> Are you sure?  For me, that setup makes C-x C-f open a minibuffer, but
> leave point in the same window, not the miniwindow.  That was a quick try
> with the emacs-27 branch, not Emacs 27.{1,2}, and was on a GUI.

Yes.  But this is an effect the user/application might want - explicitly
select some other window to, for example (I'm purely speculating), select
a completion window right away.  Iris OTOH never wants to select another
window explicitly.

> I think we should disallow selecting windows in minibuffer-setup-hook.
> This hook is run after the mini-window has been selected in read_minibuf,
> just before the recursive edit.

We cannot disallow it.  We can only undo its effect.  And that would
constitute an incompatible change - do you really want to go for it?

martin




This bug report was last modified 3 years and 354 days ago.

Previous Next


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