about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2020-12-11 18:23:16 -0600
committerCase Duckworth2020-12-11 18:23:16 -0600
commitf8f6a42dbfd1d3021993b727039d3545c21a2e3e (patch)
tree43744f2aae60125b356c704d860a19448d5fe664
parentAdd paths to exec-path (diff)
downloademacs-f8f6a42dbfd1d3021993b727039d3545c21a2e3e.tar.gz
emacs-f8f6a42dbfd1d3021993b727039d3545c21a2e3e.zip
Split windows more sensibly
-rw-r--r--config.org37
1 files changed, 37 insertions, 0 deletions
diff --git a/config.org b/config.org index 32635d9..459c179 100644 --- a/config.org +++ b/config.org
@@ -247,6 +247,43 @@ This still doesn’t work under Windows – I have to manually download the [[ht
247 (cuss indicate-empty-lines t) 247 (cuss indicate-empty-lines t)
248#+end_src 248#+end_src
249 249
250** Windows
251
252*** Split windows /more/ sensibly
253
254from [[https://stackoverflow.com/questions/23659909/reverse-evaluation-order-of-split-height-threshold-and-split-width-threshold-in][Stack Overflow]].
255
256#+begin_src emacs-lisp
257 (defun my-split-window-sensibly (&optional window)
258 (let ((window (or window (selected-window))))
259 (or (and (window-splittable-p window t)
260 ;; Split window horizontally.
261 (with-selected-window window
262 (split-window-right)))
263 (and (window-splittable-p window)
264 ;; Split window vertically.
265 (with-selected-window window
266 (split-window-below)))
267 (and (eq window (frame-root-window (window-frame window)))
268 (not (window-minibuffer-p window))
269 ;; If WINDOW is the only window on its frame and is not the
270 ;; minibuffer window, try to split it horizontally disregarding
271 ;; the value of `split-width-threshold'.
272 (let ((split-width-threshold 0))
273 (when (window-splittable-p window t)
274 (with-selected-window window
275 (split-window-right))))))))
276
277 (setq split-window-preferred-function #'my-split-window-sensibly)
278#+end_src
279
280*** Winner mode
281
282#+begin_src emacs-lisp
283 (when (fboundp 'winner-mode)
284 (winner-mode +1))
285#+end_src
286
250** Startup 287** Startup
251 288
252#+begin_src emacs-lisp 289#+begin_src emacs-lisp