branch: elpa/golden-ratio
commit 0b90ffbf028cdc4f9a0e07700602d81d7a368c29
Author: Stuart Hickinbottom <[email protected]>
Commit: Stuart Hickinbottom <[email protected]>

    Delay window reconfig to fix autofollow
    
    Delaying the reconfiguration of windows on mouse-based changes a little
    bit will also fix issue#24.
---
 golden-ratio.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/golden-ratio.el b/golden-ratio.el
index 037290c187..1301ab939b 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -115,6 +115,10 @@ will not cause the window to be resized to the golden 
ratio."
                                    (memq (car-safe com) this-command)))))
     (golden-ratio)))
 
+(defun golden-ratio--mouse-leave-buffer-hook ()
+  (run-at-time 0.1 nil (lambda ()
+                        (golden-ratio))))
+
 ;;;###autoload
 (define-minor-mode golden-ratio-mode
     "Enable automatic window resizing with golden ratio."
@@ -124,7 +128,7 @@ will not cause the window to be resized to the golden 
ratio."
       (progn
         (add-hook 'window-configuration-change-hook 'golden-ratio)
         (add-hook 'post-command-hook 'golden-ratio--post-command-hook)
-        (add-hook 'mouse-leave-buffer-hook 'golden-ratio)
+        (add-hook 'mouse-leave-buffer-hook 
'golden-ratio--mouse-leave-buffer-hook)
         (ad-activate 'other-window)
         (ad-activate 'pop-to-buffer))
       (remove-hook 'window-configuration-change-hook 'golden-ratio)

Reply via email to