[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pop-up-mini-mode, was Re: GNU Emacs raison d'etre
pop-up-mini-mode, was Re: GNU Emacs raison d'etre
Fri, 5 Jun 2020 05:40:03 +0300
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0
Sorry for the late response. A detailed reply below.
On 26.05.2020 11:06, martin rudalics wrote:
>> I forgot to ask what "startup" means here. Invoking 'pop-up-mini-mode'
>> itself or starting a dialogue as with 'ido-mode'?
> Neither. Emacs startup, and the blink that comes with re-creating the
frame. I just meant that I was going to talk about this at some later
point, but now I didn't have to.
>> >> > but didn't know
>> >> > what to attribute it to. Would be great to be able to avoid it.
>> >> Is this a blink that happens also when you do
>> >> emacs -Q --eval "(setq default-frame-alist '((minibuffer . nil)))"
>> >> or does it require the presence of a child frame?
>> > I couldn't manage to reproduce the bug there.
I'm confused. When you do
emacs -Q --eval "(setq initial-frame-alist '((minibuffer . nil)))"
you do not see any "blink". Right? When instead you do
emacs -Q --eval "(setq initial-frame-alist '((minibuffer . child-frame)))"
do you see the blink? Finally, when you do
emacs -Q --load ~/pop-up-mini.el
you see a blink. Right?
The "blink" is present in all cases. They all delete the original frame
to create one without minibuffer, right?
> One difference I noticed is that the child frame created by
> pop-up-mini-mode is constant width,
I don't understand. Here it changes its width together with its parent
Okay, it's "constant" width. I don't really change the width of the
frame often. It's the with of the frame.
> but the mini-frame created by the
> above recipe updates its width dynamically as well
Why "as well" if the pop-up-mini-mode child frame is _constant_ width?
Updates its width "as well as" its height, sorry, that was probably unclear.
Either resize-mini-frames is nil, and neither dimension updates
automatically (meaning the height always stays = 1), or both dimensions
update automatically, and the width follows the width of the prompt +
input, and that...
> . And always feels kinda cramped.
Which one is cramped? The normal minibuffer-only frame?
...feels "cramped". Yes, the (minibuffer . nil) case.
Setting this variable to 't' also has the effect of the minibuffer frame
starting to "drift" across the desktop. It's probable the same issue
we've seen with moving frames in GNOME Shell.
> In any case, it really seems like the blink is due to how updating
the size of the popup works: first, the buffer is updated (and redrawn),
then the timer resizes the popup, and the buffer is redrawn again. Not
sure what the better implementation is going to do, though.
There is one problem you cannot avoid: You have to know the size of the
minibuffer text before resizing its frame and only after that you can
determine its position (within the display or its parent frame).
I have run with pop-up-mini-mode for a few days, and not I think I have
a different conclusion: there must be at least one other bug in there,
and that one could be contributing the most annoying part of the effect:
When the aforementioned "blink" happens, it looks like the mode-line
itself "blinks" (the one that resides just below the child frame). It's
too fast to see for sure, but it seems like it travels up and then back
(meaning, the window dimensions change briefly, making the window
shorter by the same several lines). Maybe it tries to "give way" to the
phantom minibuffer which used to be below it?
When it doesn't, the resizing of the child frame happens fairly
smoothly. So if the aforementioned effect is fixed, that would be a
> Well, why else? It's the only real way we have to implement "popup"
windows. Too bad they don't work in the terminal.
We could do that just as we pop up menus in a terminal.
Perhaps Someone (sorry) could start working on that? Then we could
finally have a popup library that can be used both in terminal and
graphical Emacs. That would be a significant win. I would certainly
But such popup
windows would be modal - you cannot really pop them down to see the text
IME child frames are also always used to create modal popups.
> Not sure how it's relevant to the package under discussion. The
minibuffer frame I've tried with that default-frame-alist setup didn't
really provide a good UI, looks or behavior-wise.
The (minibuffer . nil) one or the (minibuffer . child-frame) one?
I meant the first one, but neither really works well as a minibuffer
replacement. The latter is also not very usable without the tweaks in
> Via... a frame parameter? OK, I'm probably not going to be very
helpful here, at this level of discussion detail. If there are specific
hard problems with repro senarios, I could try to take a look later, but
I'm only interested in going in this direction if our goal is to make a
package for a broad audience.
Currently, every frame must have a corresponding minibuffer window. If
you have more than one minibuffer window at hand, you have to decide
which one to choose. For example, with (minibuffer . child-frame) the
situation is clear - the minibuffer window of each frame is that of its
minibuffer child frame.
I don't know the low level details, but as long as the child frames
themselves don't get focus (hopefully all window managers we want to
support have provisions to enable that), switching the focus between
frames should be doable. At least in theory.
>> Agreed. And that's why users have to put the necessary customizations
>> in their init files and not simply call 'pop-up-mini-mode' from a
>> running session. Although the latter might be a seductive way to test
> Are you sure this customization couldn't be applied by
pop-up-mini-mode? Alternatively, it could be a setup function.
In practice 'pop-up-mini-mode' is simply not something that comes up
without customizations in your init file or by calling it from the
command line. The reason is the one explained before: You cannot
convert a minibuffer-equipped frame into a minibuffer-less frame (or do
the opposite). The same holds for (minibuffer . child-frame) and
(minibuffer . nil) setups.
Even if you can't get all the benefits of pop-up-mini-mode for old
frames (ones that were created before it was enabled), it would be
better to enable customizations inside the mode. They would apply
transparently when the mode is enabled, but otherwise stay out of the
user's custom file.
Also, I think I suggested the trick of re-creating existing frames with
minibuffers disabled (following what Emacs already does when the
minibuffer is customized to be in a dedicated frame)? That should work,
and even the ensuing "blinking" shouldn't be much of annoyance, given it
will happen in response to an explicit user command.
>> inhibits it currently. The problem perceived here is that one cannot
>> derive the actual coordinates of a frame _before_ that frame was mapped
>> by the WM and mapping always means to make it visible.
> What about full transparency, then?
You mean we should come up with a fully transparent frame first, resize
it and make it opaque then. I never played around with that but note
that this would require a compositing window manager and not all of them
support transparency of child frames.
Something like that.
Given that this blinking happens only once per "real" frame, and it's a
purely visual annoyance, I think it might be okay even if only a
fraction of our users will benefit. I kinda managed to get used to this
particular blinking after a few days.
>> OTOH the actual
>> coordinates of the minibuffer-equipped frame are needed to make the
>> minibuffer-only frame appear at the same position and with the
>> requested, properly modified size, taking the user customizations into
> The minibuffer-only frame which is immediately hidden itself while
pop-up-mini-mode is active?
The "normal" frame. Note that you have to delete the old
minibuffer-equipped frame created initially and then replace it with an
"as similar as possible" minibuffer-less frame. Look at the code of
Makes sense, yes. The "full transparency" idea could help, I think.
>> >> Also
>> >> note that we have various strategies to assign the minibuffer
>> >> ('set-minibuffer-window', the 'minibuffer' frame parameter) so
>> >> is more convoluted than it appears at first sight.
>> > These are implementation options, right? Just pick the most
>> These are user options a user can change any time in a running session.
> Perhaps we can say that they shouldn't.
I think they do already.
The users that do, will read the fine print in the package's
description. The majority doesn't touch these functions (I haven't, in
the many years of using Emacs), and if the package is going to work for
them out of the box, it's a win.
>> But you don't like such aborts ...
> I don't like abort which presume a lot of prior knowledge and/or
> "Sorry, pop-up-mini-mode is not supported in a terminal" sounds just
fine to me. There's nothing else to do anyway.
It means that when you customize the minibuffer behavior in your init
file, you will have to take into account whether you are going to work
on a terminal or a GUI or maybe both.
Again, I wish we could do it more automatically.
Otherwise the fraction of our users who can benefit from this is going
to be severely limited.
> With Lucid, the blink is the same.
OK. IIRC you had some old machine somewhere with a non-mutter WM ...
Okay, booted it up. The machine has Unity installed, which uses Compiz.
And a last year's build of Emacs 27.
The "mode-line traveling" blinking is there. Just barely perceptible,
because apparently Compiz is faster at rendering (on an older machine)
than GNOME Shell released last year.
It also happens less frequently there: I only managed to reproduce it
like 5 times out of 30 tries (with my init script). And with 'emacs -Q',
it's harder to catch, I manage to see this like 3 times out of 20 tries.
The scenario, to recap:
1. cd ~/vc/emacs-master (adjust your directory accordingly)
2. M-x ido-mode.
3. C-x C-f e (the minibuffer should grow in size to like 3 lines; if it
doesn't, change the size of the window).
4. If you saw the mode-line blink, good, if not, C-g and repeat.
And hot on the heels of this scenario, another annoyance:
When I do press C-g on step 4, first the child frame resizes to 1 line
height, then some text flashes on it (the previous contents of the
minibuffer? the current ones?), and only then it finally settles on the
empty line with the word "Quit". That happens every time. I wonder if
that could be improved, too.
> I have just tried company-posframe, which renders its popup through
the posframe package, and could find such artifacts, even when the popup
overlapped the right scroll bar.
"could find" or "could not find"?
Sorry, could not find.
> The minibuffer child frame from pop-up-mini-mode seemed to show
glitches like that when it was resized, to accommodate multiple lines.
Glitches with the scroll bar?
Yes. They weren't there with posframe.
But I just tried to reproduce these scroll bar glitches with with
x-gtk-resize-child-frames=resize-mode, and couldn't, in ant of the
configurations. And posframe sets up this variable's value, so that's
>> I'd still like to see a list of what people really would like to see
>> positioning and resizing the minibuffer window first.
> Does the list at the bottom here look useful?
You mean the list of positions? We can add that to 'pop-up-mini-mode'
if we make sure that the child frame always fits into its parent.
Although we do not care much about the size of the minibuffer window of
a minibuffer-equipped frame when that frame gets very small either.
I meant, does that list answer your question? The one about "what people
really would like to see wrt positioning and resizing the minibuffer
> If we had something like that, as well as automatic resizing of the
minibuffer popup without blinking, that would be great. Especially if
the result worked fine with packages such as icomplete-vertical-mode.
Since I already don't use icomplete investigating the latter would be
quite demanding for me.
What do you use? M-x icomplete-mode is a trivial command, and it should
be unobtrusive even if you're used to the default completion.
Does 'icomplete-vertical-mode' have problems
with Emacs' default minibuffer layout?
It has problems with every child frame based minibuffer emulation
package that I have tried. But no problems with Emacs' default minibuffer.
|[Prev in Thread]
||[Next in Thread]|
- pop-up-mini-mode, was Re: GNU Emacs raison d'etre,
Dmitry Gutov <=