GNU bug report logs - #59963
29.0.50; 'window-max-chars-per-line' doesn't always work on GUI without fringe

Previous Next

Package: emacs;

Reported by: Akib Azmain Turja <akib <at> disroot.org>

Date: Sun, 11 Dec 2022 12:32:02 UTC

Severity: normal

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59963 <at> debbugs.gnu.org, akib <at> disroot.org
Subject: bug#59963: 29.0.50; 'window-max-chars-per-line' doesn't always work on GUI without fringe
Date: Mon, 12 Dec 2022 17:50:44 +0100
>> (let (max-chars)
>>     (setq right-fringe-width 0)
>>     (setq max-chars (window-max-chars-per-line))
>>     (set-window-buffer nil (window-buffer))
>>     max-chars)
>>
>> which currently yields 79 and would yield 80 with your proposal.
>
> Do we have such code somewhere?

No.  Fringes should be set by users only.

> The correct way of doing that is to
> swap the lines that call window-max-chars-per-line and
> set-window-buffer, because AFAIU the latter will cause window-margins

... 'window-max-chars-per-line' I presume ...

> to return the values consistent with right-fringe-width just set.

My example is a simplification.  There might be many more buffer-local
variables to set and the conclusive 'set-window-buffer' call to put them
into action might appear much later, maybe also in some other function.

The simplest approach should be to put an extra

(set-window-buffer nil (window-buffer))

right after the

  (with-selected-window (window-normalize-window window t)

in 'window-max-chars-per-line'.  But there's no right KEEP-MARGINS value
to pass here.

Maybe you should just say in the doc-string that if there are any
pending buffer-local changes, they should be applied before calling
'window-max-chars-per-line'.

martin




This bug report was last modified 2 years and 239 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.