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

    Prevent recenter error in post-command-hook for emacs-25.
    
    * golden-ratio.el (golden-ratio--post-command-hook): Delay call to 
golden-ratio
    until window to resize get its current-buffer.
    This error happen only in emacs-25.
---
 golden-ratio.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/golden-ratio.el b/golden-ratio.el
index 495c961ea8..b28e88bb75 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -120,7 +120,10 @@ will not cause the window to be resized to the golden 
ratio."
                  (loop for com in golden-ratio-extra-commands
                        thereis (or (memq com this-command)
                                    (memq (car-safe com) this-command)))))
-    (golden-ratio)))
+    ;; This is needed in emacs-25 to avoid this error from `recenter':
+    ;; `recenter'ing a window that does not display current-buffer.
+    ;; This doesn't happen in emacs-24.4 and previous versions.
+    (run-with-idle-timer 0.01 nil (lambda () (golden-ratio)))))
 
 (defun golden-ratio--mouse-leave-buffer-hook ()
   (run-at-time 0.1 nil (lambda ()

Reply via email to