Skip to content
Browse files

Merge pull request #19 from deftsp/inhabit-func

Support exclusions based on inhabit function
  • Loading branch information...
2 parents 9843ca2 + ef6f8ce commit 7504957a7a9d37ec8c5be380c206b1e64731e928 @roman committed
Showing with 13 additions and 4 deletions.
  1. +13 −4 golden-ratio.el
View
17 golden-ratio.el
@@ -40,6 +40,13 @@ window to be resized to the golden ratio."
:type '(repeat string)
:group 'golden-ratio)
+(defcustom golden-ratio-inhibit-functions nil
+ "List of functions to call with no arguments. Switching to a
+buffer, if any of these functions returns non-nil will not cause
+the window to be resized to the golden ratio."
+ :group 'golden-ratio
+ :type 'hook)
+
(defun -golden-ratio-dimensions ()
(let* ((main-rows (floor (/ (frame-height) -golden-ratio-value)))
(main-columns (floor (/ (frame-width) -golden-ratio-value))))
@@ -68,10 +75,12 @@ window to be resized to the golden ratio."
(interactive)
(if (and (not (window-minibuffer-p))
(not (one-window-p))
- (not (member (symbol-name major-mode)
- golden-ratio-exclude-modes))
- (not (member (buffer-name)
- golden-ratio-exclude-buffer-names)))
+ (not (member (symbol-name major-mode)
+ golden-ratio-exclude-modes))
+ (not (member (buffer-name)
+ golden-ratio-exclude-buffer-names))
+ (not (run-hook-with-args-until-success
+ 'golden-ratio-inhibit-functions)))
(progn
(balance-windows)
(-golden-ratio-resize-window (-golden-ratio-dimensions)

0 comments on commit 7504957

Please sign in to comment.
Something went wrong with that request. Please try again.