branch: elpa/golden-ratio
commit 807c441682c8d398fc83de6b4023b2d251502f63
Author: Roman Gonzalez <[email protected]>
Commit: Roman Gonzalez <[email protected]>
Add one extra advice to golden-ratio for window-numbering.el support
---
golden-ratio.el | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/golden-ratio.el b/golden-ratio.el
index dfe6baf6e9..fd64c5cc73 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -56,7 +56,7 @@ will not cause the window to be resized to the golden ratio."
"List of extra commands used to jump to other window."
:group 'golden-ratio
:type '(repeat symbol))
-
+
;;; Compatibility
;;
(unless (fboundp 'window-resizable-p)
@@ -108,6 +108,11 @@ will not cause the window to be resized to the golden
ratio."
(around golden-ratio-resize-window)
(prog1 ad-do-it (golden-ratio)))
+(when (fboundp 'select-window-by-number)
+ (defadvice select-window-by-number
+ (after golden-ratio-resize-window)
+ (golden-ratio) nil))
+
(defun golden-ratio--post-command-hook ()
(when (or (memq this-command golden-ratio-extra-commands)
(and (consp this-command) ; A lambda form.
@@ -126,11 +131,15 @@ will not cause the window to be resized to the golden
ratio."
(add-hook 'window-configuration-change-hook 'golden-ratio)
(add-hook 'post-command-hook 'golden-ratio--post-command-hook)
(ad-activate 'other-window)
- (ad-activate 'pop-to-buffer))
+ (ad-activate 'pop-to-buffer)
+ (when (fboundp 'select-window-by-number)
+ (ad-activate 'select-window-by-number)))
(remove-hook 'window-configuration-change-hook 'golden-ratio)
(remove-hook 'post-command-hook 'golden-ratio--post-command-hook)
(ad-deactivate 'other-window)
- (ad-activate 'pop-to-buffer)))
+ (ad-deactivate 'pop-to-buffer)
+ (when (fboundp 'select-window-by-number)
+ (ad-deactivate 'select-window-by-number))))
(provide 'golden-ratio)