Subject: bug#16351: 24.3.50; `balance-windows' has no effect after (menu-bar-mode -1)

From: martin rudalics <[email-masked]>
Date: Mon, 06 Jan 2014 18:46:31 +0100

> Hmm, it seems that this is a issue of my current window manager.
 > With good old twm i can't reproduce that, too.

This shouldn't be an issue of the window manager.  Otherwise, we would
have a very nasty bug.

So if you still can reproduce the bug please proceed as follows:
`balance-windows' has this code

     ;; Balance vertically.
     (window--resize-reset (window-frame window))
     (balance-windows-1 window)
     (when (window--resize-apply-p frame)
       (window-resize-apply frame)
       (window--pixel-to-total frame)
       (run-window-configuration-change-hook frame))

First change this code to

     ;; Balance vertically.
     (window--resize-reset (window-frame window))
     (balance-windows-1 window)
     (when (window--resize-apply-p frame)
       (unless (window-resize-apply frame)
	(ding))
       (window--pixel-to-total frame)
       (run-window-configuration-change-hook frame))

If Emacs now "dings" we know that the values written by
`balance-windows-1' are wrong.  In this case replace the code by

     ;; Balance vertically.
     (window--resize-reset (window-frame window))
     (balance-windows-1 window)
     (when (window--resize-apply-p frame)
       (unless (window-resize-apply frame)
	(message
	 "%s"
	 (list (cons (window-pixel-height) (window-new-pixel))
	       (cons (window-pixel-height (window-in-direction 'below))
		     (window-new-pixel (window-in-direction 'below)))
	       (cons (window-pixel-height (window-parent))
		     (window-new-pixel (window-parent))))))
	(window--pixel-to-total frame)
       (run-window-configuration-change-hook frame))

invoke C-x + from the _upper_ window and post the value written by
`message' here (just copy it from the buffer *Messages*).

Thanks, martin