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

From: Drew Adams <[email-masked]>
Date: Fri, 28 Mar 2014 08:29:59 -0700 (PDT)

Trying to pick up this bug thread again.  I'm afraid your last mail
is confusing to me at this point.

This is what I've done for this test:

1. Ensure, I think, that the only calls to `set-frame-size' are from
my calling `fit-frame' interactively (via C-x C-_).  Nothing on
`post-command-hook' that invokes `set-frame-size', for instance.

2. Resized a frame manually (with the mouse), so that the next call
to `fit-frame' would actually change the size (to fit the buffer text).

3. C-x C-_ (`fit-frame'), which fit the frame, with no loss of the
mode line.

4.  C-x C-_ again, which fit the frame (as a no-op, no size change
needed), this time with loss of the mode line (the bug).

Attached is the log, *window-frame-dump*.  After #3, I added a
line of zeros to the buffer, to make clear where the second call to
`fit-frame' (hence `set-frame-size') occurred.

The relevant lines from `fit-frame' are these:

(with-current-buffer (get-buffer-create "*window-frame-dump*")
  (insert (format "::: Requested WIDTH: %S, HEIGHT: %S\n" wid hgt)))
(set-frame-size frame wid hgt))))))

And this is the `window-dump-frame' code I used:

(defun window--dump-frame (&optional window-or-frame)
  "..."
  (interactive)
  (let* ((window
	  (cond
	   ((or (not window-or-frame)
		(frame-live-p window-or-frame))
	    (frame-root-window window-or-frame))
	   ((or (window-live-p window-or-frame)
		(window-child window-or-frame))
	    window-or-frame)
	   (t
	    (frame-root-window))))
	 (frame (window-frame window)))
    (with-current-buffer (get-buffer-create "*window-frame-dump*")
      ;;(erase-buffer)
      (insert
       (format "\nframe pixel: %s x %s   cols/lines: %s x %s   \
units: %s x %s\n"
	       (frame-pixel-width frame) (frame-pixel-height frame)
	       (frame-total-cols frame) (frame-text-lines frame)
	       (frame-char-width frame) (frame-char-height frame))
       (format "frame text pixel: %s x %s   cols/lines: %s x %s\n"
	       (frame-text-width frame) (frame-text-height frame)
	       (frame-text-cols frame) (frame-text-lines frame))
       (format "tool: %s  scroll: %s  fringe: %s  border: %s  \
right: %s  bottom: %s\n"
	       (tool-bar-height frame t)
	       (frame-scroll-bar-width frame)
	       (frame-fringe-width frame)
	       (frame-border-width frame)
	       (frame-right-divider-width frame)
	       (frame-bottom-divider-width frame))
       (format "w32-rect: %S, %S\n"
               (w32-frame-rect frame)
               (w32-frame-rect frame t)))
      (walk-window-tree 'window--dump-window frame t t))))

HTH.