Subject: Re: bug#58804: Inconsistency between ruler-mode, fill-column and whitespace-mode

From: Eli Zaretskii <[email-masked]>
Date: Thu, 27 Oct 2022 09:34:39 +0300

> Date: Thu, 27 Oct 2022 06:15:23 +0000
> From: Heime <[email-masked]>
> Cc: [email-masked]
> 
> > > but it should be at column 71 because column numbers start from 0.
> > 
> > 
> > I don't follow: ruler-mode counts columns starting from zero, as
> > everything in Emacs. If you move point to a column other than the
> > leftmost one, you will see "0" at the left edge of the ruler display.
> > So having the marker at column 72 is exactly right.
> 
> When one is using a box cursor, it is very confusing.  If one has 
> whitespace-style with 'lines-char, the column with the Right Ruler Marker 
> gets highlighted.

So I guess this is a bug in whitespace-mode?  Its doc string says:

   lines-char           lines which have columns beyond
                        ‘whitespace-line-column’ are highlighted via
                        putting a face on the first character that goes
                        beyond the ‘whitespace-line-column’ column.

So highlighting the character whose column is whitespace-line-column,
not whitespace-line-column+1, seems to be a bug?

> When users have a box cursor, it is convenient that
> the Right Ruler Marker is placed on the last column where it is acceptable
> to introduce a last character without exceeding line-column.

That's what happens now (and box cursor is the default cursor style).
The problem seems to be in whitespace-mode, not in ruler-mode.

> > It sounds like you want column numbers that start from 1, not zero?
> > That should be a session-wide mode (if we want such an enhancement),
> > since otherwise there could be confusion. We currently support
> > one-based column only in the mode-line display under
> > column-number-mode. Maybe you have turned that on, which is why you
> > think there's a mismatch in ruler-mode?
> 
> Yes, to start from 1, not zero - when one uses a "box cursor".

I don't think I understand the relevance of the cursor-type to this
issue.

> And yes, I have both ruler-mode, whitespace-mode, and
> column-number-mode, all three enabled.  I would appreciate if I
> could make the necessary customisations for all three to match.

That would need some new minor mode or user option, I guess, and
suitable changes in several places to follow the optional behavior.
Patches welcome.