Subject: 26.1.50; Fixed-size windows break 'balance-windows'

From: martin rudalics <[email-masked]>
Date: Sun, 04 Nov 2018 11:18:02 +0100

I have been informed about the existence of this bug by Akio Burns.
Unfortunately, he has not reacted so far to my request to file a bug
report so I'm sloppily doing this here instead:

With emacs -Q type C-x 2 C-x 2 C-x b RET

This should put you in the *Messages* buffer.  Now do

M-: (setq window-size-fixed t)

followed by

M-: (balance-windows)

Window sizes remain unchanged.  The attached patch should fix that.  I
would like to apply it to the release branch.  Objections?

Thanks, martin
diff --git a/lisp/window.el b/lisp/window.el
index f96c887..03e0c96 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5305,11 +5305,12 @@ balance-windows-2
 	 (total-sum parent-size)
 	 failed size sub-total sub-delta sub-amount rest)
     (while sub
-      (setq number-of-children (1+ number-of-children))
-      (when (window-size-fixed-p sub horizontal)
-	(setq total-sum
-	      (- total-sum (window-size sub horizontal t)))
-	(set-window-new-normal sub 'ignore))
+      (if (window-size-fixed-p sub horizontal)
+          (progn
+            (setq total-sum
+	          (- total-sum (window-size sub horizontal t)))
+	    (set-window-new-normal sub 'ignore))
+        (setq number-of-children (1+ number-of-children)))
       (setq sub (window-right sub)))
 
     (setq failed t)