Subject: Re: bug#59963: 29.0.50; 'window-max-chars-per-line' doesn't always work on GUI without fringe

From: Eli Zaretskii <[email-masked]>
Date: Sun, 11 Dec 2022 18:14:28 +0200

> From: Akib Azmain Turja <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 11 Dec 2022 21:21:13 +0600
> 
> I just found the root cause.  I've used '(set-window-fringes nil 0 0)'
> (from Doom as said by the original reporter) to hide fringe.  It doesn't
> set 'left-fringe-width' and 'right-fringe-width', which are checked by
> 'window-max-chars-per-line'.  Setting these two variables to zero fixes
> the bug.

It is wrong to use left-fringe-width and right-fringe-width here,
because those are per _buffer_ not per _window_.  set-window-fringes
doesn't set them for this very reason, and it shouldn't.

> Now I think this is a bug of _both_ Emacs and Doom.  Doom doesn't set
> the variables, hence this bug report here; and Emacs doesn't check
> 'window-fringes'.
> 
> What do you think?

Using left/right-fringe-width in window-max-chars-per-line is IMO
wrong, we should use window-fringes (which will return correct values
both when the window has its private valuesm, either via
set-window-fringes or via assignment of left/right-fringe-width, and
when it doesn't).

Martin, any comments?