Skip to content

Commit

Permalink
Merge pull request #19 from deftsp/inhabit-func
Browse files Browse the repository at this point in the history
Support exclusions based on inhabit function
  • Loading branch information
roman committed Nov 20, 2012
2 parents 9843ca2 + ef6f8ce commit 7504957
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions golden-ratio.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7504957

Please sign in to comment.