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

From: Joost Kremers <[email-masked]>
Date: Mon, 02 Mar 2015 04:18:23 +0100

On Sun, Mar 01 2015, martin rudalics <[email-masked]> wrote:
>  > 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.

I cloned the git master branch and compiled Emacs (version says it's
25.0.50.1) and still see the same problem.

After Eli's comments, it's now clear that the problem is slightly
different than what I initially thought, though. The issue is not with
font size changes in general, because the frame is usually adjusted to
match. The problem arises when a font size change takes place *without*
the frame changing its size accordingly. In this case, the number of
columns on a frame is changed, but this is not reflected in the return
value of `window-total-width`.

This happened in my case because I ran the test on a maximised Emacs
frame, which wasn't adjusted. (Though I don't know whether that's due to
Emacs not resizing its frame or due to the window manager preventing
it.)

Here are the results from the calls to `window--dump-frame` (done on
Emacs 25.0.50.1):

========== one ==============================
right before `face-spec-recalc'

frame pixel: 1920 x 971   cols/lines: 240 x 57   units: 8 x 17
frame text pixel: 1888 x 971   cols/lines: 236 x 57
tool: 0  scroll: 16/0  fringe: 16  border: 0  right: 0  bottom: 0

#<window 3 on *ielm*>   parent: nil
pixel left: 0   top: 0   size: 1920 x 954   new: 0
char left: 0   top: 0   size: 240 x 56   new: 0
normal: 1.0 x 1.0   new: 0
body pixel: 1888 x 937   char: 236 x 55
width left fringe: 8  left margin: 0  right margin: 0
width right fringe: 8  scroll-bar: 16  divider: 0
height header-line: 0  mode-line: 17  divider: 0

#<window 4 on  *Minibuf-0*>   parent: nil
pixel left: 0   top: 954   size: 1920 x 17   new: 0
char left: 0   top: 56   size: 1920 x 1   new: 0
normal: 1.0 x 1.0   new: 0
body pixel: 1888 x 17   char: 236 x 1
width left fringe: 8  left margin: 0  right margin: 0
width right fringe: 8  scroll-bar: 16  divider: 0
height header-line: 0  mode-line: 0  divider: 0

=============================================

========== two ==============================
right after `face-spec-recalc`

frame pixel: 1920 x 971   cols/lines: 192 x 46   units: 10 x 21
frame text pixel: 1888 x 971   cols/lines: 188 x 46
tool: 0  scroll: 16/0  fringe: 16  border: 0  right: 0  bottom: 0

#<window 3 on *ielm*>   parent: nil
pixel left: 0   top: 0   size: 1920 x 950   new: 950
char left: 0   top: 0   size: 240 x 45   new: 56
normal: 1.0 x 1.0   new: ignore
body pixel: 1888 x 929   char: 188 x 44
width left fringe: 8  left margin: 0  right margin: 0
width right fringe: 8  scroll-bar: 16  divider: 0
height header-line: 0  mode-line: 21  divider: 0

#<window 4 on  *Minibuf-0*>   parent: nil
pixel left: 0   top: 950   size: 1920 x 21   new: 0
char left: 0   top: 45   size: 1920 x 1   new: 0
normal: 1.0 x 1.0   new: 0
body pixel: 1888 x 21   char: 188 x 1
width left fringe: 8  left margin: 0  right margin: 0
width right fringe: 8  scroll-bar: 16  divider: 0
height header-line: 0  mode-line: 0  divider: 0

=============================================

========== three ============================
after doing `C-x 3` + `C-x 1`

frame pixel: 1920 x 971   cols/lines: 192 x 46   units: 10 x 21
frame text pixel: 1888 x 971   cols/lines: 188 x 46
tool: 0  scroll: 16/0  fringe: 16  border: 0  right: 0  bottom: 0

#<window 3 on *ielm*>   parent: nil
pixel left: 0   top: 0   size: 1920 x 950   new: 960
char left: 0   top: 0   size: 192 x 45   new: 96
normal: 1.0 x 1.0   new: 0.5
body pixel: 1888 x 929   char: 188 x 44
width left fringe: 8  left margin: 0  right margin: 0
width right fringe: 8  scroll-bar: 16  divider: 0
height header-line: 0  mode-line: 21  divider: 0

#<window 4 on  *Minibuf-0*>   parent: nil
pixel left: 0   top: 950   size: 1920 x 21   new: 0
char left: 0   top: 45   size: 192 x 1   new: 192
normal: 1.0 x 1.0   new: 0
body pixel: 1888 x 21   char: 188 x 1
width left fringe: 8  left margin: 0  right margin: 0
width right fringe: 8  scroll-bar: 16  divider: 0
height header-line: 0  mode-line: 0  divider: 0

=============================================

-- 
Joost Kremers
Life has its moments