Subject: Re: bug#76193: 30.0.93; Wrong type argument in outline-minor-mode

From: Roshan Shariff <[email-masked]>
Date: Tue, 11 Feb 2025 11:39:22 -0700

On Tue, 11 Feb 2025 at 00:58, Juri Linkov <[email-masked]> wrote:
> Thanks for the bug report.  outline-minor-mode was not intended
> to work for left-margin-width set to a non-zero value from outside.

Thanks, I wasn't sure what the intent of the code was, but that makes
sense. However, the condition on line 552, which only holds if the
margin width is zero, seems to make some of the following code
redundant. Lines 566-569 add the current margin width to
outline--margin-width, which is unnecessary if the current margin
width has to be zero to get to that point. The reverse happens when
the mode is disabled, in lines 616-619.

> I wonder do you know a case where the same margin is successfully shared
> between outline-minor-mode and some other package?

It seems to work reasonably well as long as the margins are wide
enough to show all the margin indicators. However, the other packages
I use (flymake-mode and git-gutter-mode) unilaterally set the margin
size to whatever they need without accounting for other packages' use
of the margin. The final margin ends up depending on the order that modes
are activated.

In my case, flymake-mode (which defaults to margin indicators on
graphical displays) was setting the margin width to 2, and by pure
coincidence that is wide enough to show the outline-minor-mode and
git-gutter symbols if there isn't a flymake indicator on that line.

> In any case this information is not required for fixing outline-minor-mode
> that should support any value of left-margin-width.

> Do you agree that the right fix would be just do nothing
> when outline--margin-width is nil?

That is one approach, but the other one would be to just remove the (>
1 *-margin-width) condition on line 552. If I understand correctly,
the effect would be to increase the existing margin to accommodate the
outline-minor-mode buttons, and then decrease the margins by the same
amount when the mode is disabled.

I feel this change would play better with other packages that use the
margin, and ideally those packages (e.g. flymake-mode) would be
patched to do the same thing. What do you think?