Subject: bug#20022: [External] : bug#19194: bug#20022: 24.4.90; window-body-height, window-body-width wrong value after text-scale-adjust

From: Drew Adams <[email-masked]>
Date: Thu, 10 Feb 2022 17:39:44 +0000

> > Adjusting the font size, I would expect that the window's "body width"
> > would change -- more characters can be fit into the same amount of
> > screen space.  Current behaviour does not match this expectation.
> >
> > M-: (window-body-width) RET  [Note result.]
> > C-x C--
> > M-: (window-body-width) RET  [Result is the same.]
> >
> > The function is described:
> >
> > "This function returns the width, in columns, of the body of window
> > window."
> >
> > If for some reason the "nominal" number of columns needs to calculated
> > with reference to the default font, then there should be another
> > function to return the "actual" number of columns.
> 
> Skimming this thread, I think the conclusion here is that these
> functions work as designed.  `C-x C--' reduces the size of the font in
> the current buffer, but the "window body width" concept remains the
> same.  (I.e., if you create a new buffer and display it, that's what
> `window-body-width' is telling you the number of columns for.)
> 
> So I don't think there's anything to do here, and I'm closing this bug
> report.

The functions work as designed, yes.  But the design
could be improved.

You can decide whether this comment is relevant to
this bug report.  I think it's related, but it's not
exactly the same suggestion/problem.

I've proposed an enhancement to optionally resize
the window to fit the newly displayed text -
shrinking the text shrinks the window etc.  This
enhancement can free up frame or screen real estate
for other windows or frames.

This is not the same as the enhancement hinted at
in this bug report, which I guess is instead to
reflow the text to accommodate/fill the space
provided by the changed text size.  That makes
sense especially if `visual-line-mode' is used.
The enhancement I describe makes sense especially
if that mode is not used.

I've suggested my enhancement before, but it was
rejected, even though it's behavior change is
optional.  I describe it again here, FWIW.

I provide the enhancement in the tiny bit of code
that is library `face-remap+.el' (attached).  It
provides a user option, `text-scale-resize-window',
and it redefines `text-scale-increase' to respect
that option.  A patch is trivial.