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: Dmitry Gutov
Subject: Re: GNU Emacs raison d'etre
Date: Fri, 22 May 2020 02:16:08 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 21.05.2020 12:07, martin rudalics wrote:

Not really.  There's C code that relies on the invariant that a
minibuffer/echo area window exists at each and every moment of execution
(I know because I once spent some time to find them all).  If we manage
to remove that single window, Emacs may just crash.

Hmm, okay.

 > I've also noticed that initial blink during startup, 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. Even with resize-mini-frames=t. But then, it doesn't resize as responsively as your code.

 > - The user installs the package and turns the mode one. If we can't
 > disable the minibuffer, maybe just enable the rest of the
 > functionality, and describe minibuffer-disabling-on-init functionality
 > separately? It could even just be a line we'd tell the users to put in
 > their init script.

It's not as simple as that.  Users who want to use that mode have to
make themselves familiar with child frames and minibuffer-only frames
first.

Please, no.

You know the reason why we only fixed child frames under GNOME now? Or why packages using child frames only started to become popular?

This is arcane stuff, and it took someone really motivated to turn the child frames support you created into a library every Emacs developer can use. There are a few other authors who understand it, but we can't expect the average user to know these details.

And even after that there may be glitches, especially when
working with multiple frames.  For example, transferring focus from one
frame to another, while a minibuffer interaction is in progress, is a
hairy operation regardless of whether you use the standard setup, a
top-level minibuffer(-only) frame or a minibuffer child frame.

Is there a problem in creating a minibuffer child frame for every frame?

 > Alternatively, since you described what happens currently,
 > pop-up-mini-mode could try to remember the current window
 > configuration, create a new frame on the same position without a
 > minibuffer, restore the window configuration there, and delete the
 > original frame. Or is that something that could only happen during
 > startup?

I would have to guess the user's intention here.  'pop-up-mini-mode'
does not forbid a mixed mode where one frame uses its own minibuffer
window for interaction and other frames want to use the more "global"
minibuffer-only window 'pop-up-mini-mode' found when it started.

We don't have to support every possible intention, just the most likely one. The rest can be left for future development, or available as a customization option.

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?

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.

 > - pop-up-mini-mode is enabled in the user's init script. Is that worse
 > than early init? We could try to document the early init as the best
 > option.

It's not a good option if it fails for some reason.  On a TTY, say.

So pop-up-mini-mode would check if it's running on a terminal, and if so, abort with a message.

 >> You would have to tell me more about that blink.  If it's due to the
 >> setting of 'x-gtk-resize-child-frames', there's nothing I can do about
 >> it.  If it's due to the delay implied by 'pop-up-mini-hide-if-empty',
 >> try to experiment with that.
 >
 > My x-gtk-resize-child-frames value is 'resize-mode.
 >
 > Blinking happens when it's resized. But not every single time.
 >
 > Here's what I do:
 >
> 1. src/emacs -Q --eval "(setq x-gtk-resize-child-frames 'resize-mode)" -l ~/.emacs.d/site-lisp/pop-up-mini.el
 >
 > 2. M-x ido-mode.
 >
> 3. C-x C-f, type 'e'. If you're inside Emacs source directory, the completions should span 2-3 lines. When the child frame is resized, it will blink. Sometimes it looks like the mode-line quickly moves up and back (or at least _something_ grey moves like that).

I can't reproduce that here.  But I'm on xfce and currently can't test
with GNOME shell which disabled itself during its never-ending attempts
of unattended upgrades.

A full reinstall of a distro and/or switch to another one is out of the question, I take it?

I'm not sure it's a GNOME issue. It doesn't update itself: package managers do it.

 > Instead of ido-mode, fido-mode can be used with similar effect. Though
 > blinking seems less frequent with it.

Again, it would be interesting to know whether this happens with mutter
only.

With Mutter only, or with GTK3 toolkit build only? I can make a build using a different toolkit, at least.

> Another issue: when the child frame covers the scroll bar, it renders some junk on it.

The horizontal scroll bar?  That's where it is here all the time.

The vertical one. The child frame spans the whole width of the frame, and its right end overlaps the parent frame's scroll bar.

 >> Not really enthusiastic.  The historical constraints of how to set up
 >> and use the minibuffer window are too restrictive IMHO so what you see
 >> here is just a workaround.  Maybe things will change in a couple of
 >> years.
 >
 > Do you mean the child frame problems?

No.  I spent a couple of months in the intestines of the minibuffer
window implementation and came to the conclusion that sooner or later it
will break down under the load people are piling up on it.

Nobody here can tell you how many messages go by unnoticed in a session
because one last message hides all the ones that were emitted earlier.
And as soon as we start a minibuffer interaction, we enter an area where
a message may temporarily obscure (or amend to?) parts of the text we
just entered.  And all this happens because we got used to it over the
decades like the frog being boiled alive.

I agree it's a problem, just don't see how it is a problem for this particular endeavor.

What should be reformed here are two things:

- Break up the conflation of minibuffer and echo area you mentioned
   earlier.

- Provide the possibility to make the minibuffer window temporarily
   nonexistent (invisible or dead).

Both are hard to achieve.  The conflation was a premature optimization.
People got used to it with the consequence that it will be very hard to
dissolve it.  Having a minibuffer window always present is a restriction
that is now "built in".  Dissolving it is hard because it would require
to amend lots of code used to the fact that that window is always here.

Sounds like we're talking about low-level code only, right? Like prin1. I suspect there's a limited number of functions like that.

 > BTW, here's a today's thread on Reddit with similar complaints by
 > users:
> https://www.reddit.com/r/emacs/comments/gmsnoy/minibufferecho_area_ergonomics/

IIUC this one's about using Emacs on a TTY.  In that case
minibuffer-only frames won't help anyway.

> One suggestion option is this package: https://github.com/muffinmad/emacs-mini-frame.

Years ago I wrote the code to put the minibuffer window on top of a
frame - something which should work on TTYs as well.  But it's annoying:
When resizing the minibuffer, the entire text in the windows beneath has
to move up or down.  When the minibuffer window is at the bottom, the
text in the windows above usually only gets truncated.

Right. That's a similar reason why I really want minibuffer out of the current frame: as soon as it gets multiline, window borders start jumping up and down.

 > There are a few others with this goal as well. But none of them try to
 > hide the minibuffer (or know that it's possible, looks like). They
 > only create a child frame with an "effective" minibuffer, and position
 > it to their liking. Whereas the minibuffer line is left untouched, and
 > is only used as echo area.

It would be interesting to see a list of requirements for a practical
solution to this problem.

Behavior-wise, I think we're fairly close already, but "the user has to get familiar with both, minibuffer windows and child frames, first" sounds like a deal-breaker.



reply via email to

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