branch: elpa/golden-ratio
commit 549f94c2dbadb414cc3f734452ef5d24a5263474
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    * golden-ratio.el: Clean up, add some commands. Ready to merge.
---
 golden-ratio.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/golden-ratio.el b/golden-ratio.el
index 6cbdb5f059..dfe6baf6e9 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -89,12 +89,14 @@ will not cause the window to be resized to the golden 
ratio."
                    (loop for fun in golden-ratio-inhibit-functions
                          always (funcall fun))))
     (let ((dims (golden-ratio--dimensions))
-          (golden-p golden-ratio-mode))
-      (and golden-p (golden-ratio-mode -1))
+          (golden-p (if golden-ratio-mode 1 -1)))
+      ;; Always disable `golden-ratio-mode' to avoid
+      ;; infinite loop in `balance-windows'.
+      (golden-ratio-mode -1)
       (balance-windows)
       (golden-ratio--resize-window dims)
       (scroll-right) (recenter)
-      (and golden-p (golden-ratio-mode 1)))))
+      (golden-ratio-mode golden-p))))
 
 ;; Should return nil
 (defadvice other-window
@@ -108,7 +110,7 @@ will not cause the window to be resized to the golden 
ratio."
 
 (defun golden-ratio--post-command-hook ()
   (when (or (memq this-command golden-ratio-extra-commands)
-            (and (consp this-command)
+            (and (consp this-command) ; A lambda form.
                  (loop for com in golden-ratio-extra-commands
                        thereis (or (memq com this-command)
                                    (memq (car-safe com) this-command)))))

Reply via email to