Skip to content

Instantly share code, notes, and snippets.

@hjiang
Created October 23, 2019 10:01
Show Gist options
  • Save hjiang/f3a1a08a93fbfa85dc59d9a48cf98950 to your computer and use it in GitHub Desktop.
Save hjiang/f3a1a08a93fbfa85dc59d9a48cf98950 to your computer and use it in GitHub Desktop.
Smart split for Emacs
(defun smart-split ()
"Split the frame into 80-column sub-windows, and make sure no window has
fewer than 80 columns."
(interactive)
(cl-lables ((smart-split-helper (lambda (w)
(if (> (window-width w) (* 2 81))
(let ((w2 (split-window w 82 t)))
(smart-split-helper w2))))))
(smart-split-helper nil)))
(smart-split)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment