emacs-devel
[Top][All Lists]
Advanced

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

Re: GNU Emacs raison d'etre


From: martin rudalics
Subject: Re: GNU Emacs raison d'etre
Date: Tue, 26 May 2020 10:06:09 +0200

>> 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?

> 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
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?

> . And always feels kinda cramped.

Which one is cramped?  The normal minibuffer-only frame?

> 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).

> 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.  But such popup
windows would be modal - you cannot really pop them down to see the text
beneath them.

> 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?

>>  > Is there a problem in creating a minibuffer child frame for every frame?
>>
>> I had that in an initial version but it's unlikely that I can still find
>> the code.  By design, you can create and use an arbitrary number of
>> minibuffer frames.  The only problem is to find the right frame you want
>> to use ...
>
> 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.

>> 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
>> it.
>
> 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.

>>  > BTW, when you delete the initial frame at startup, is there a
>>  > possibility to make in invisible at the start, so that it's actually
>>  > never displayed, and when it's deleted, that blink doesn't happen?
>>
>> You mean when Emacs starts in minibuffer-only mode, I presume.  It
>> should be possible but the following part
>>
>>          ;; If the frame isn't visible yet, wait till it is.
>>          ;; If the user has to position the window,
>>          ;; Emacs doesn't know its real position until
>>          ;; the frame is seen to be visible.
>>          (while (not (cdr (assq 'visibility
>>                     (frame-parameters frame-initial-frame))))
>>            (sleep-for 1))
>>
>> 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.

>> 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
>> account.
>
> 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
'frame-notice-user-settings'.

>>  >> Also
>>  >> note that we have various strategies to assign the minibuffer window
>>  >> ('set-minibuffer-window', the 'minibuffer' frame parameter) so all this
>>  >> is more convoluted than it appears at first sight.
>>  >
>>  > These are implementation options, right? Just pick the most appropriate.
>>
>> 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.

>> But you don't like such aborts ...
>
> I don't like abort which presume a lot of prior knowledge and/or manual setup.
>
> "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.

> With Lucid, the blink is the same.

OK.  IIRC you had some old machine somewhere with a non-mutter WM ...

> 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"?

> 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?

>> I'd still like to see a list of what people really would like to see wrt
>> positioning and resizing the minibuffer window first.
>
> Does the list at the bottom here look useful? 
https://github.com/honmaple/emacs-maple-minibuffer/#maple-minibufferpostion-type

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.

> 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.  Does 'icomplete-vertical-mode' have problems
with Emacs' default minibuffer layout?

martin



reply via email to

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