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: Wed, 4 Nov 2020 17:39:54 +0000

Hello, Eli.

On Wed, Nov 04, 2020 at 18:47:10 +0200, Eli Zaretskii wrote:
> > Date: Tue, 3 Nov 2020 21:08:53 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > OK, I've extracted a new function `live_minibuffer_p'  from
> > Fminibufferp, and call that directly from the mini-window emptying
> > code.  (The new second parameter in Fminibufferp is still needed,
> > since it is used in minibuffer.el.)

> > Here's a patch of the subset of changes to minibuf.c which are
> > relevant to our discussions of the last two or three days.  Perhaps
> > we are close to the stage when this could be committed to master.

> Yes, I think so.

Maybe I should do that this evening.  WDYT?

> > +  if (EQ (buffer, Fcar (Vminibuffer_list)))
> > +    /*  *Minibuf-0* is never active.  */
> > +    return false;
> > +  tem = Fcdr (Vminibuffer_list);
> > +  for (i = 1; i <= minibuf_level; i++, tem = Fcdr (tem))
> > +    if (EQ (Fcar (tem), buffer))
> > +      return true;
> > +  return false;

> I'm curious: why a loop instead of a call to Fmemq?

Because Vminibuffer_list is a list of all minibuffers which have ever
been active.  When the use of a MB is terminated, the MB stays on the
list (for reuse), and minibuf_level is decremented.

So an Fmemq would need somehow to ignore the end of the Vminibuffer_list.
Just doing a loop in C seems simpler.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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