summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-01-01 23:44:53 -0500
committerKyle Meyer <kyle@kyleam.com>2014-01-01 23:44:53 -0500
commit88283b7deaf8067561b2dcd2a80b2e722a477eca (patch)
tree97ea11171a5d2f1c83c5246403fcfc0d6d16d706 /init
parentbfd1ded1fe13b53f20db00871c204db7ad4287b7 (diff)
downloademacs.d-88283b7deaf8067561b2dcd2a80b2e722a477eca.tar.gz
Toggle frame split function
Diffstat (limited to 'init')
-rw-r--r--init/km-func.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/init/km-func.el b/init/km-func.el
index 536abc3..90a4734 100644
--- a/init/km-func.el
+++ b/init/km-func.el
@@ -221,3 +221,17 @@ is non-nil, the region is copied with `x-select-text'."
(interactive)
(let ((fill-column (point-max)))
(fill-paragraph nil)))
+
+;; http://www.emacswiki.org/emacs/ToggleWindowSplit
+(defun km/toggle-frame-split ()
+ "If the frame is split vertically, split it horizontally or vice versa.
+Assumes that the frame is only split into two."
+ (interactive)
+ (unless (= (length (window-list)) 2)
+ (error "Can only toggle a frame split in two"))
+ (let ((split-vertically-p (window-combined-p)))
+ (delete-window)
+ (if split-vertically-p
+ (split-window-horizontally)
+ (split-window-vertically))
+ (switch-to-buffer nil)))