unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 59963@debbugs.gnu.org, akib@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	[thread overview]
Message-ID: <807e40b5-41a1-7a1a-52d2-5815399fa7a2@gmx.at> (raw)
In-Reply-To: <83iligsr7r.fsf@gnu.org>

 >> (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





  reply	other threads:[~2022-12-12 16:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-11 11:13 bug#59963: 29.0.50; 'window-max-chars-per-line' doesn't always work on GUI without fringe Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-11 14:43 ` Eli Zaretskii
2022-12-11 14:50   ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]   ` <87o7sac78t.fsf@disroot.org>
2022-12-11 15:21     ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-11 16:14       ` Eli Zaretskii
2022-12-12  8:18         ` martin rudalics
2022-12-12 13:10           ` Eli Zaretskii
2022-12-12 16:50             ` martin rudalics [this message]
2022-12-14 15:21             ` Eli Zaretskii
2022-12-15 15:53               ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-17 12:05                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=807e40b5-41a1-7a1a-52d2-5815399fa7a2@gmx.at \
    --to=rudalics@gmx.at \
    --cc=59963@debbugs.gnu.org \
    --cc=akib@disroot.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).