Subject: RE: bug#16923: 24.3.50; reression: `set-frame-size' loses mode line

From: Drew Adams <[email-masked]>
Date: Thu, 6 Mar 2014 10:25:30 -0800 (PST)

>  > I was pretty sure that the mode line also disappears in some cases
>  > when moving to a different node.  But I definitely do not see that
>  > now, so I guess I was mistaken about that.
> 
> (1) The mode line disappears only when the frame size remains the same.
>      Check this please via the arguments you pass (to `set-frame-size' or
>      whatever you use).
> 
> (2) Everything else is drawn correctly, there's no area with background
>      space only, as you claimed earlier.
> 
> Is that correct (from your experience, so far)?  You might want to
> attach a screenshot.

Yes, that is what I was saying.  However, testing by printing the sizes
as messages shows that I was wrong (once again).  The mode line can
disappear, it seems, either when the size is the same or when it
increases.

Here are some debug messages, where ====== means the size was not changed
and /////// means that it was changed.  The old and new sizes are also
noted.

These resizings were not associated with losing the mode line:

CUR: (81 63)
NEW: (76 63)
//////////////////////
CUR: (76 61)
NEW: (81 63)
//////////////////////

These, immediately after those, were:

CUR: (81 61)
NEW: (81 63)
//////////////////////
CUR: (81 63)
NEW: (81 63)
====================

That is, the mode line was lost when the height changed from 61 to 63,
and it remained lost when the size was not changed, on the next call
to `set-frame-size'.

In the following sequence of resizings, starting with a visible mode
line, only this change caused the mode line to disappear.  And it
reappeared at the next resizing.

   CUR: (72 20)
   NEW: (72 22)

----------------

CUR: (81 63)
NEW: (72 63)
//////////////////////
CUR: (72 61)
NEW: (72 53)
//////////////////////
CUR: (72 51)
NEW: (72 62)
//////////////////////
CUR: (72 60)
NEW: (72 63)
//////////////////////
CUR: (72 61)
NEW: (72 22)
//////////////////////
CUR: (72 20)
NEW: (72 22)
//////////////////////
CUR: (72 22)
NEW: (72 47)
//////////////////////

---------------

That was using Info.  Note that though the `height' parameter value was
slightly increased when the mode line was lost, I saw no apparent change
in the frame size.  Dunno what that means.

>  > Actually, now I can repro it more simply, without using Info.  In my
>  > setup, if I do M-: (fit-frame) more than once in the same frame, the
>  > mode line sometimes disappears.  For most buffers/frames, it disappears.
>  > But not always.  It does not disappear for `list-faces-display', for
>  > some reason.  (It does disappear for `list-colors-display'.)

With this test of repeating M-: (fit-frame), this is what I see.  The
(240 2) messages are from inputting (fit-frame) into the minibuffer frame,
for M-:. The minibuffer frame is 240 chars wide and 2 chars high.

Evaluating...
CUR: (95 62)
NEW: (95 73)
//////////////////////
Buffer `*Pp Eval Output*' is in mode `Emacs-Lisp'.   For info on the mode: `C-h m'.
nil
CUR: (240 2)
NEW: (240 2)
====================
Evaluating...
CUR: (95 71)
NEW: (95 73)
//////////////////////
Buffer `*Pp Eval Output*' is in mode `Emacs-Lisp'.   For info on the mode: `C-h m'.
nil

Again, there was no apparent change in the frame height, in spite of the
change in `height' parameter value.  The first frame-fit, from height 62
to 73, did represent a size change.  The second, from 71 to 73, did not
show any size change.  The only change I noticed was the mode line
disappearing.

> Add the following function to your .emacs ...
> 
> (defun window--resize-root-window 
>    (window delta horizontal ignore pixelwise)
>    ...)
> 
> ... and post the contents of the buffer *window-frame-dump* after a
> fatal resize operation here (but make sure to not resize any frame again
> _before_ getting hold of that buffer's contents!!!).

I tried that, but buffer *window-frame-dump* never was filled with any
text.  And I never saw any "fatal resize".  IOW, evaluating that defun
did not have any effect that I noticed.  I did still continue to
observe the behavior I have recorded above, however.  IOW, the mode line
continued to disappear in the same way, with no changes that I could
see.

Do I need to do something more than just evaluate that defun?  Do
I need to restart Emacs and do that first or something?  (You mentioned
putting it in .emacs, instead of just evaluating it.  I just evaluated
it.)