Subject: Re: bug#77313: 30.1.50; Regression: flymake indicators are erroneously using margins

From: Eli Zaretskii <[email-masked]>
Date: Thu, 27 Mar 2025 18:52:46 +0200

> From: Spencer Baugh <[email-masked]>
> Cc: [email-masked]
> Date: Thu, 27 Mar 2025 12:28:39 -0400
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> Date: Thu, 27 Mar 2025 11:13:44 -0400
> >> From:  Spencer Baugh via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <[email-masked]>
> >> 
> >> The addition of margin-based flymake indicators in Emacs 30 (for use in
> >> terminal frames) also led to a regression: the margin-based indicators
> >> are uglier and should not be used when not necessary, but the code for
> >> determining the default for flymake-indicator-type was wrong and caused
> >> margin indicators to be used sometimes on graphical frames.
> >
> > Please tell how that could or did happen.
> 
> e.g.:
> 
> 1. emacs --daemon -l flymake
> 2. emacsclient -c somefile.el -f flymake-mode
>    (opening a graphical frame)

You can reset the option in after-make-frame-functions.

The daemon is known to be tricky in turning on GUI features; many of
them need to be (re)initialized in after-make-frame-functions.  That
doesn't mean we will be turning off all the features that cater to
text-only frames due to those complications.

> >> The simplest fix, suitable for backporting, is to always default to
> >> fringes.
> >
> > Which means there will be no indicators on TTY frames, right?
> 
> There were never indicators in TTY frames in Emacs 29.

Yes, and Emacs 30 attempted to improve the situation.  Going back is a
step in the wrong direction.

> In Emacs 30, there will also be no indicators on TTY frames if, for
> example, the user does:
> 
> 1. emacs (opening a graphical Emacs)
> 2. (require 'flymake)
>    The default of flymake-indicator-type is now 'fringes, since display-graphic-p is true.
> 3. emacsclient -t
>    No indicators.

I'm okay with making this smarter, but I object to making it dumber.

> > If you don't like the default for a user option, you can easily
> > customize it locally.  But why make that change for everyone?  Options
> > are options so that they could be easily adapted to local needs.
> 
> Because it's a regression from Emacs 29.

Only in certain situations.  The most popular situation where the
users get a TTY frame is when they invoke "emacs -nw", and there we
have an improvement, as intended.

> Keep in mind I was the one who, while reviewing the flymake patch adding
> margins, suggested that TTY frames automatically default to using
> margins.  This code exists because I requested it.  I sadly did not
> realize that the behavior was implemented with a buggy default value for
> flymake-indicator-type, nor was it caught before release; I only just
> now have received direct user complaints about the regression.

That's fine.  We all make mistakes.  But the way to correct those
mistakes is not to go back, it's to go forward.

So I urge you to work on a fix which doesn't disable the indicators in
"emacs -nw", but instead attempts to detect the situations you
describe above and adapt the indicator style to them.