Subject: bug#37826: Very annoying autoraise client/server behavior with -t option

From: Eli Zaretskii <[email-masked]>
Date: Mon, 21 Oct 2019 19:13:19 +0300

> From: Carlos Pita <[email-masked]>
> Date: Mon, 21 Oct 2019 11:18:04 -0300
> Cc: [email-masked]
> 
> >
> > > And how to know when to delay/ignore and when to show if there is no
> > > priority hint?
> >
> > I think this is pretty clear: we want to delay when a shell script is
> > visited via the client.
> 
> I didn't mean what common sense would tell us in each case, but how to
> codify that in rules that don't quickly become a long list of patterns
> always missing some case (and then there are non-builtin packages...).

Maybe I don't understand what you are asking.  The important part of
my answer is "visited via the client", so I'm not sure what is hard in
that rule.

> > In that case, we visit the file in an existing frame.  By contrast,
> > the client needs to create a frame, and if it does that before
> > visiting the file, it will momentarily show some other buffer in that
> > frame.
> > [...]
> > No, because it will flash an empty buffer, something that Emacs
> doesn't do.
> 
> I don't get this, in both cases we have a frame that is created and a
> file that is visited. The client has the extra possibility of
> pre-loading the buffer without selecting it, which you have exploited.
> But standalone emacs has to show something before.

No, it shows the visited file immediately.

> I'm checking that right now and it indeed shows a blank screen
> (plenty of "flashes" while resizing, hiding bars, etc).

That "empty screen" is really empty, i.e. it's a window created by the
windowing system, and Emacs didn't yet display anything there.  Your
suggestion would show a buffer, with its mode line and other
decorations.  That's what the change you are talking about wanted to
avoid.

> Isn't "blank -> desired buffer" much better than "random visited
> buffer -> desired buffer" in terms of flashing? Could we give that a
> try?

I'd like to try cleaner solutions first, okay?

> I certainly don't see the current focus stealing behavior as cosmetic
> or minor

But it happens only in a small number of major modes, right?  Until
now, you identified just one: shell-script mode.  Are there others?