emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stop frames stealing eachothers' minibuffers!


From: Alan Mackenzie
Subject: Re: Stop frames stealing eachothers' minibuffers!
Date: Sat, 31 Oct 2020 19:44:19 +0000

Hello again, Eli.

On Sat, Oct 31, 2020 at 18:45:19 +0200, Eli Zaretskii wrote:
> > Date: Sat, 31 Oct 2020 16:14:22 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > > > @@ -416,11 +471,12 @@ read_minibuf (Lisp_Object map, Lisp_Object 
> > > > initial, Lisp_Object prompt,
> > > >      {
> > > >        Lisp_Object str
> > > >         = build_string ("Command attempted to use minibuffer while in 
> > > > minibuffer");
> > > > -      if (EQ (selected_window, minibuf_window))
> > > > -       Fsignal (Quser_error, (list1 (str)));
> > > > +      if (!minibuf_follows_frame ()
> > > > +          || EQ (selected_window, minibuf_window))
> > > > +        Fsignal (Quser_error, (list1 (str)));

> > > I don't think I understand this change: what does
> > > minibuffer-follows-selected-frame have to do with recursive minibuffer
> > > usage?  They are two independent features.

> > They're not as independent as all that.  The existing logic appeared to
> > say "if we're in the miniwindow, just abort the current command,
> > otherwise abort all nested commands.".  Extending that logic to when we
> > have several miniwindows, we'd (perhaps) get "if we're in _A_ miniwindow
> > just abort the current command.".

> > Which, further extended, goes "if we're in ANY window, just abort the
> > current command.".  I agree, this is an independent feature from the
> > main one.  But it brings consistency (and, possibly, usability) to this
> > abort facility.  I can put this back to more or less what it was.  But
> > why do we abort the whole command stack when there's just a single
> > error?

> Sorry, you've lost me here.  The existing logic is: if we are in a
> minibuffer with minibuf_level > 1, then we throw to top-level, either
> by signaling a user-error or silently.  Your change introduced the
> call to minibuf_follows_frame into this equation, and I just cannot
> understand what business does it have here?  Recursive minibuffers
> should be "verboten" regardless of whether the minibuffer follows the
> selected frame or not.  What am I missing here?

Maybe I'm not being coherent.  I think it would be better not to abort
the first command when a user accidentally tries to invoke a recursive
minibuffer.  But it's not a big point.

I can't remember very clearly, but I think I made this change early on in
the project because the Fthrow (Qexit, str); left some mini-windows in a
messy state; or something like that.  That doesn't happen any more.

So, maybe I should just remove this hunk from the proposed patch.  It
doesn't seem that important any more.

> > > > -  /* Empty out the minibuffers of all frames other than the one
> > > > -     where we are going to display one now.
> > > > -     Set them to point to ` *Minibuf-0*', which is always empty.  */
> > > > -  empty_minibuf = get_minibuffer (0);
> > > > -
> > > > -  FOR_EACH_FRAME (dummy, frame)
> > > > -    {
> > > > -      Lisp_Object root_window = Fframe_root_window (frame);
> > > > -      Lisp_Object mini_window = XWINDOW (root_window)->next;
> > > > -
> > > > -      if (! NILP (mini_window) && ! EQ (mini_window, minibuf_window)
> > > > -         && !NILP (Fwindow_minibuffer_p (mini_window)))
> > > > -       /* Use set_window_buffer instead of Fset_window_buffer (see
> > > > -          discussion of bug#11984, bug#12025, bug#12026).  */
> > > > -       set_window_buffer (mini_window, empty_minibuf, 0, 0);
> > > > -    }

> > > Does this mean the minibuffers on other frames will now not be emptied?

> > Yes, indeed.  If minibuffer-follows-selected-frame, there'll only be a
> > single mini-window, which we're about to write into, so there's no point
> > emptying out a null set of other windows.

> That's the intention, perhaps, but are we really 110% sure this will
> happen?  And where's the alternative code which will make sure the
> other minibuffers are cleared in this case?

Maybe something like edebug invoked from a recursive edit when there's a
minibuffer live.  That could be problematic, perhaps.

How about emptying mini-windows which don't have live minibuffers on
them?  This could be tested by Fminibufferp (b, Qt).  In practice, when
minibuffer-follows-selected-frame this would empty all mini-windows but
the current one, and when !m-f-s-f it would leave intact the mini-windows
we want to be left intact.

To be honest, I think I've been seeing stale messages hanging around in
echo areas, and this emptying might clear them out.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]