Subject: Re: bug#19194: 24.4.50; `window-body-width' is not dynamic relative to font size changes

From: martin rudalics <[email-masked]>
Date: Thu, 27 Nov 2014 10:44:56 +0100

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

The doc-string of `text-scale-adjust' is slightly misleading.

(defun text-scale-adjust (inc)
   "Adjust the height of the default face by INC.

AFAICT this does not change the height of the default face - it affects
how the display engine calculates the height of text when displaying a
buffer current at the time `text-scale-adjust' was called.

I'm not sure whether we want to define the size of a window in terms of
the buffer displayed in that window.  One consequence of such a change
would be that the sum of the total height of two windows might no more
equal the total height of their parent window.

If we did, we'd need a way to conveniently specify a buffer's default
character width/height.  Then we should probably redefine a number of
functions like `shrink-window' or `split-window' to work in terms of
that value.  And maybe specify a mode to control that behavior.

 > ( I note one practical implication of the underlying issue here:
 > https://github.com/kiwanami/emacs-calfw/issues/45 )

If you told me how you get the "adjusted font size", I could tell you
how to scale the value returned by `window-body-width' accordingly.

martin