Subject: Re: bug#70894: [PATCH] * lisp/window.el (fit-window-to-buffer): Fix width calculation

From: Eli Zaretskii <[email-masked]>
Date: Sun, 19 May 2024 11:09:29 +0300

> Date: Sun, 19 May 2024 09:58:58 +0200
> Cc: [email-masked]
> From: martin rudalics <[email-masked]>
> 
>  > Martin, any comments?
> 
> Looks good to me.  Principally, instead of subtracting the sizes of the
> decorations from the initial total width and re-adding them later, they
> should have been added to the calculated pixel width as is done when
> fitting the height.

OK, I installed the patch on master now, thanks.

> But mildly spoken, 'fit-window-to-buffer' is a complete mess in the
> first place.  Calculating sizes in terms of lines/columns doesn't make
> sense.  If really necessary - minibuffer resizing, for example, does not
> care - results should be rounded in a final step.  Also, I doubt that
> both char-width and char-height are calculated reasonably when buffer
> text is scaled or line spacing changed.

For the last issue: we should use default-font-width/height.  But the
question is: would replacing frame-char-width/height by these two fix
that use case, or do we need anything else?