From: martin rudalics <rudalics@gmx.at>
To: Aaron Jensen <aaronjensen@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 56102@debbugs.gnu.org
Subject: bug#56102: 29.0.50; fit-frame-to-buffer's window-text-pixel-size calculation can be incorrect when only is set to vertically
Date: Mon, 27 Jun 2022 10:24:08 +0200 [thread overview]
Message-ID: <aa2dd74a-5088-8f77-b003-e4ba5a9dc221@gmx.at> (raw)
In-Reply-To: <CAHyO48wX27rFvTfd1jE5W-=9F3kNEQ6D2BU2xet_USwbiEkkCQ@mail.gmail.com>
>> With a non-standard setup, say
>> after doing
>>
>> (set-window-margins nil 10 10)
>>
>> in the root window, your fix will fail with the scenario you provided
>> earlier.
>
> Ah, I can confirm this. Is there a reasonable way for me to calculate
> a max-width that would be based on the root window that would work?
Here
(set-window-margins nil 10 10)
(fit-frame-to-buffer nil nil nil (window-body-width) nil 'vertically)
seems to work.
> There's other math that happens within fit-frame-to-buffer I don't
> fully have my head wrapped around yet. I'm not super worried about
> this personally as I don't set window margins on this window.
Similar problems should happen when the fringe or scroll bar sizes of
the root window or its buffer differ from that of the frame.
> The patch works for me and seems good. When you say if you come up
> with a reasonable fix, could I ask what is unreasonable about the
> patch you attached?
The current code interprets all its -HEIGHT and -WIDTH arguments as if
they were body sizes and not total sizes. This at least contradicts the
doc-strings of 'fit-frame-to-buffer-sizes' and of 'fit-frame-to-buffer'
itself. If I can fix the problem by rewriting the doc-strings to match
what the code does, I'll probably do that. In general, you can't get
these right anyway when you allow specifications in terms of character
sizes and windows/frames may have non-integral sizes wrt these.
> Regardless, if you do end up updating the fix to respect a supplied
> max-width even if only vertically is supplied, I could always make an
> Emacs version based decision on whether or not to pass the work-around
> max-width in, and Emacs 29 is as good a version as any to stop passing
> it in (people already on master will have to recompile, but that's
> fine imo). So, I would be fine with the new patch going straight to
> master, though as I mentioned I don't know what it would do
> differently or why.
I don't know yet either. I'll send you a patch as soon as I have one.
martin
next prev parent reply other threads:[~2022-06-27 8:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 3:03 bug#56102: 29.0.50; fit-frame-to-buffer's window-text-pixel-size calculation can be incorrect when only is set to vertically Aaron Jensen
2022-06-22 13:58 ` Eli Zaretskii
2022-06-22 14:15 ` Aaron Jensen
2022-06-23 7:30 ` martin rudalics
2022-06-24 2:28 ` Aaron Jensen
2022-06-24 9:20 ` martin rudalics
2022-06-24 14:28 ` Aaron Jensen
2022-06-26 10:09 ` martin rudalics
2022-06-26 13:12 ` Aaron Jensen
2022-06-27 8:24 ` martin rudalics [this message]
2022-06-27 13:24 ` Aaron Jensen
2022-06-28 9:29 ` martin rudalics
2022-06-28 14:52 ` Aaron Jensen
2022-07-05 13:07 ` Aaron Jensen
2022-07-06 7:37 ` martin rudalics
2022-07-06 13:17 ` Aaron Jensen
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=aa2dd74a-5088-8f77-b003-e4ba5a9dc221@gmx.at \
--to=rudalics@gmx.at \
--cc=56102@debbugs.gnu.org \
--cc=aaronjensen@gmail.com \
--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).