summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-07-13 10:02:00 +0100
committerSean Whitton <spwhitton@spwhitton.name>2023-07-13 10:02:32 +0100
commite8eb26b849cd60a64c3965ca1d277ad81f25aea1 (patch)
treecb461645d622a71105924c38a09a6a900b215f32
parentf2a9499d3b98c9688a84bd424709200e1941e817 (diff)
downloaddotfiles-e8eb26b849cd60a64c3965ca1d277ad81f25aea1.tar.gz
add spw/maybe-toggle-split-after-resize
-rw-r--r--.emacs.d/init.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 735d620e..93341f05 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -2233,6 +2233,18 @@ Useful after resizing the frame."
(when this-win-2nd (other-window 1))))))
(define-key spw/personal-bindings-mode-map "\M-5" #'spw/toggle-frame-split)
+(defun spw/maybe-toggle-split-after-resize (frame)
+ (when (and (framep frame)
+ (frame-size-changed-p frame)
+ (< (frame-width frame) split-width-threshold))
+ (with-selected-frame frame
+ (when (and (= (count-windows) 2)
+ (/= (car (window-edges (selected-window)))
+ (car (window-edges (next-window)))))
+ (spw/toggle-frame-split)))))
+(add-to-list 'window-size-change-functions
+ #'spw/maybe-toggle-split-after-resize)
+
;; orig http://blog.gleitzman.com/post/35416335505/hunting-for-unicode-in-emacs
(defun spw/unicode-hunt ()
"Destroy some special Unicode characters like smart quotes."