From e8eb26b849cd60a64c3965ca1d277ad81f25aea1 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 13 Jul 2023 10:02:00 +0100 Subject: add spw/maybe-toggle-split-after-resize --- .emacs.d/init.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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." -- cgit v1.2.3