From 88283b7deaf8067561b2dcd2a80b2e722a477eca Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Wed, 1 Jan 2014 23:44:53 -0500 Subject: Toggle frame split function --- init/km-func.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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))) -- cgit v1.2.3