diff options
author | Case Duckworth | 2020-12-22 20:32:24 -0600 |
---|---|---|
committer | Case Duckworth | 2020-12-22 20:32:47 -0600 |
commit | 2979ad470ae9eb541af77b1855b4d70850cefc00 (patch) | |
tree | 178dee34b8bb6cd7fbba08afdcde1e7460c7bc07 | |
parent | Change indicate-buffer-boundaries (diff) | |
download | emacs-2979ad470ae9eb541af77b1855b4d70850cefc00.tar.gz emacs-2979ad470ae9eb541af77b1855b4d70850cefc00.zip |
Move my-split-window-sensibly
-rw-r--r-- | config.org | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/config.org b/config.org index bdaf66e..5ca1a9a 100644 --- a/config.org +++ b/config.org | |||
@@ -284,34 +284,6 @@ when it errors. | |||
284 | 284 | ||
285 | ** Windows | 285 | ** Windows |
286 | 286 | ||
287 | *** Split windows /more/ sensibly | ||
288 | |||
289 | from [[https://stackoverflow.com/questions/23659909/reverse-evaluation-order-of-split-height-threshold-and-split-width-threshold-in][Stack Overflow]]. | ||
290 | |||
291 | #+begin_src emacs-lisp | ||
292 | (defun my-split-window-sensibly (&optional window) | ||
293 | (let ((window (or window (selected-window)))) | ||
294 | (or (and (window-splittable-p window t) | ||
295 | ;; Split window horizontally. | ||
296 | (with-selected-window window | ||
297 | (split-window-right))) | ||
298 | (and (window-splittable-p window) | ||
299 | ;; Split window vertically. | ||
300 | (with-selected-window window | ||
301 | (split-window-below))) | ||
302 | (and (eq window (frame-root-window (window-frame window))) | ||
303 | (not (window-minibuffer-p window)) | ||
304 | ;; If WINDOW is the only window on its frame and is not the | ||
305 | ;; minibuffer window, try to split it horizontally disregarding | ||
306 | ;; the value of `split-width-threshold'. | ||
307 | (let ((split-width-threshold 0)) | ||
308 | (when (window-splittable-p window t) | ||
309 | (with-selected-window window | ||
310 | (split-window-right)))))))) | ||
311 | |||
312 | (setq split-window-preferred-function #'my-split-window-sensibly) | ||
313 | #+end_src | ||
314 | |||
315 | *** Winner mode | 287 | *** Winner mode |
316 | 288 | ||
317 | #+begin_src emacs-lisp | 289 | #+begin_src emacs-lisp |