roman / golden-ratio.el

Automatic resizing of Emacs windows to the golden ratio
MIT License
590 stars 38 forks source link

C-M-v to scroll the other buffer won't work when this mode enabled. #17

Closed redguardtoo closed 11 years ago

redguardtoo commented 11 years ago

as title.

redguardtoo commented 11 years ago

Here is the fix. As you can see, it's actually not necessary to call (balance-windows) in defadvice select-window

diff --git a/golden-ratio.el b/golden-ratio.el
index afcffaa..e346637 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -63,7 +63,7 @@ window to be resized to the golden ratio."

 ;;;###autoload
-(defun golden-ratio ()
+(defun golden-ratio (balance-windows-p)
   "Resizes current window to the golden-ratio's size specs"
   (interactive)
   (if (and (not (window-minibuffer-p))
@@ -73,22 +73,22 @@ window to be resized to the golden ratio."
       (not (member (buffer-name)
            golden-ratio-exclude-buffer-names)))
       (progn
-        (balance-windows)
+        (if balance-windows-p (balance-windows))
         (-golden-ratio-resize-window (-golden-ratio-dimensions)
                                      (selected-window)))))

 (defadvice select-window
   (after golden-ratio-resize-window)
-  (golden-ratio))
+  (golden-ratio nil))

 (defadvice other-window
   (after golden-ratio-resize-window)
-  (golden-ratio))
+  (golden-ratio t))

 (defadvice split-window
   (after golden-ratio-resize-window)
-  (golden-ratio))
+  (golden-ratio t))

 ;;;###autoload
thierryvolpiatto commented 11 years ago

Fixed in https://github.com/thierryvolpiatto/golden-ratio.el.git