Subject: Re: bug#19972: 24.4; Font size change doesn't update (window-total-width)

From: martin rudalics <[email-masked]>
Date: Sun, 01 Mar 2015 16:14:38 +0100

> After changing the font size (with `custom-push-theme' and
 > `face-spec-recalc'), the value returned by `window-total-width' is not
 > updated.
 >
 > To reproduce, run `emacs -Q' and do:
 >
 > - (window-total-width) ; shows the initial value
 > - (custom-push-theme 'theme-face 'default 'user 'set '((t (:height 128))))
 >    ; use a :height value that's actually different from the default height.
 > - (face-spec-recalc 'default (selected-frame))
 > - (window-total-width) ; still shows the initial value
 > - C-x 3 ; split window horizontally
 > - C-x 1 ; delete other window
 > - (window-total-width) ; shows the new value
 >
 > The second call to `window-total-width' should already have returned the
 > new value.
 >
 > The following IELM transcript (recorded directly after `emacs -Q') shows
 > the problem:
 >
 > ELISP> (window-total-width)
 > 240 (#o360, #xf0, ?ð)
 > ELISP> (custom-push-theme 'theme-face 'default 'user 'set '((t (:height 128))))
 > ((theme-face default user
 > 	     ((t
 > 	       (:height 128)))))
 >
 > ELISP> (face-spec-recalc 'default (selected-frame))
 > nil
 > ELISP> (window-total-width)
 > 240 (#o360, #xf0, ?ð)
 >
 > ;; now press `C-x 3` followed by `C-x 1'
 >
 > ELISP> (window-total-width)
 > 192 (#o300, #xc0, ?À)
 > ELISP>
 >
 > The second call to `window-total-width` returns 240, but it should have
 > returned 192.

I must admit that I don't have the faintest idea what `face-spec-recalc'
is supposed to do.  I don't understand its doc-string and don't know
where further documentation about it can be found in the manuals.  So I
would be grateful if you or someone else provided me with the necessary
information.

Anyway.  Why do you think that `window-total-width' should return 192 in
the first call?  In principle, face/font changes are supposed to keep
the number of columns/lines unchanged so returning 240 seems reasonable
to me.  Unfortunately, the fact that ...

 > After splitting the window and deleting the other window
 > again, the correct value is returned.

... seems to consitute a bug which, however, I haven't been able to
reproduce here.  One further puzzling aspect: Here, `face-spec-recalc'
makes the frame so large that it goes off-screen and I can't see the
modeline any more.  And you seem to expect the window to shrink ...

 > Note that splitting the window vertically (`C-x 2`) does *not* fix the
 > value returned by `window-total-width'.

Hopefully not.  Everything else would be strange.

In any case, please evaluate (window--dump-frame) in IELM once
immediately before you invoke `face-spec-recalc', once immediately after
you invoked it, and once after you did C-x 1.  You have to copy the
results from a buffer called *window-frame-dump* (three times, because
each dump overwrites the previous one).  Please post the results here.

 > In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2)
 >   of 2014-10-22 on IdeaPad

Could you try with current master/trunk?  Lots of things changed in this
area recently.

martin