diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 5afb67a..af3adac 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -115,16 +115,21 @@ (defun rhjr/split-window-80col () "Split the selected window into two side-by-side windows, -with the left one exactly 80 columns wide, when only one -window is open. If two windows are already open, leave the -layout untouched and just select the right window." +with the left one exactly 88 columns wide, when only one +window is open. If two windows are already open, resize the +left one back to 88 columns (undoing any manual resizing) +and select the right window." (interactive) (if (one-window-p t) (progn (split-window-right 88) (other-window 1)) - (when-let ((w (window-right (selected-window)))) - (select-window w)))) + (let* ((left (or (window-left (selected-window)) (selected-window))) + (right (window-right left)) + (delta (- 88 (window-width left)))) + (unless (zerop delta) + (window-resize left delta t)) + (select-window right)))) (defun rhjr/swap-windows () "Swap the buffers/states of the two windows in the current frame, @@ -135,6 +140,11 @@ than following the buffer." (window-swap-states nil (next-window)) (select-window this-window))) +(defun my/compile-preserve-size () + (when-let ((win (get-buffer-window (current-buffer)))) + (window-preserve-size win nil t))) +(add-hook 'compilation-start-hook #'my/compile-preserve-size) + ;;; rhjr/mode (menu-bar-mode -1) (tool-bar-mode -1) @@ -144,6 +154,7 @@ than following the buffer." (global-display-line-numbers-mode 1) (delete-selection-mode 1) (column-number-mode 1) +(recentf-mode 1) ;;; rhjr/packages (use-package magit