From a6410697d20010f6233d16e1d22a1fcc7f946e71 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sat, 5 Jun 2021 16:56:43 +0200 Subject: [PATCH] Clean up split-windows functions --- bundle/bundle--mk.el | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/bundle/bundle--mk.el b/bundle/bundle--mk.el index a25f4aa4..f48bf0a7 100644 --- a/bundle/bundle--mk.el +++ b/bundle/bundle--mk.el @@ -34,25 +34,24 @@ (interactive "nHow many splits? ") (delete-other-windows) (let ((width (/ (window-total-width) count-windows))) - (let ((count 0)) - (while (< count (1- count-windows)) - (split-window-right (- 0 width)) - (setf count (1+ count)))))) + (dotimes (i (1- count-windows)) + (split-window-right (- width))))) + +(defun me/split-windows-vertical (count-windows) + "Split windows vertical by equal width." + (interactive "nHow many splits? ") + (delete-other-windows) + (let ((height (/ (window-total-height) count-windows))) + (dotimes (i (1- count-windows)) + (split-window-below (- height))))) (defun me/split-h3 () (interactive) (me/split-windows-horizontal 3)) -(defun me/split-windows-vertical () - "Split windows vertical by equal width." +(defun me/split-v3 () (interactive) - (setq count-windows 3) - (delete-other-windows) - (let ((height (/ (window-total-height) count-windows))) - (setq count 0) - (while (< count (1- count-windows)) - (split-window-below (- 0 height)) - (setq count (1+ count))))) + (me/split-windows-vertical 3)) (add-to-list 'org-latex-classes '("koma-article"