Subject: Re: bug#76934: 31.0.50; rectangle-mark-mode resets fringe-mode settings

From: Stephen Berman <[email-masked]>
Date: Sat, 29 Mar 2025 13:55:22 +0100

On Sat, 29 Mar 2025 15:34:20 +0300 Eli Zaretskii <[email-masked]> wrote:

>> From: Stephen Berman <[email-masked]>
>> Cc: [email-masked],  [email-masked]
>> Date: Sat, 29 Mar 2025 12:41:47 +0100
>>
>> On Sat, 29 Mar 2025 14:13:09 +0300 Eli Zaretskii <[email-masked]> wrote:
>>
>> >> Cc: [email-masked]
>> >> Date: Tue, 11 Mar 2025 19:16:44 +0200
>> >> From: Eli Zaretskii <[email-masked]>
>> >>
>> >> > Date: Tue, 11 Mar 2025 14:34:09 +0000
>> >> > From: the_wurfkreuz <[email-masked]>
>> >> > Cc: [email-masked]
>> >> >
>> >> > Initially, there is the fringe area (shown in the attached file called
>> >> > "first-screenshot"). I can interactively execute the fringe-mode command
>> >> > it choose the 'minimal' option. It makes the fringe area to visually
>> >> > disappear and emacs adjusts the space between the fringe of the window and
>> >> > line numbers accordingly (shown in the second-screenshot). Then i use the
>> >> > rectangle-mark-mode command and doing so returns the space that was
>> >> > previously taken by the fringe area back (shown in the
>> >> > third-screenshot). Yes, the added space doesn't use any highlighting, so
>> >> > you can't verify it by looking at the highlighting for the fringe-area, my
>> >> > description was confusing on that part.
>> >>
>> >> Looks like Emacs decided it needed one more columns for the line
>> >> numbers, probably because the current line moved to line 9, and maybe
>> >> also because the window's glyph matrix was enlarged for some reason.
>> >> IOW, this has nothing to do with the fringes.
>> >
>> > No further comments, so I'm now closing this bug.
>>
>> The observations I made in this thread (that the extra space is
>> triggered by rectangle-mark-mode but remains after cancelling
>> rectangle-mark-mode, and that splitting the window vertically removes
>> the extra space) involve a buffer with only three lines, and regardless
>> of the number of lines I think they indicate buggy or at least
>> surprising behavior.  Does closing the bug mean you think the observed
>> behavior is fine, and if so, why is it fine?
>
> Yes, I think this behavior is fine, given the evidence presented.
>
> It is fine because the code which decides how much space to allocate
> for line numbers doesn't (and cannot) know how many lines are actually
> in the buffer; the only thing it knows is the number of the current
> line.

I don't see how that's relevant to the observed behavior, namely, that
the extra space is triggered by rectangle-mark-mode apparently
regardless of the number of lines or what the current line number is
(and remains after rectangle-mark-mode is cancelled), and that the extra
space is not displayed when the window is vertically split.

> If you want to convince me that there is a problem here that should be
> solved, please step with a debugger through the relevant code and
> point out where you think the code does the wrong thing, and why.

> Please also note that the original bug report was about a completely
> different issue, as seen from the Subject.

Well, rectangle-mark-mode is certainly part of the issue according to my
observations, while the reference to fringe-mode was evidently a
mischaracterization of the observed behavior.  Anyway, I'll try to do
some debugging at some point, and if I find anything worth reporting,
I'll open a new bug.

Steve Berman