1
0
Fork 0

Fixed: behaviour of compilation buffer

Browse Source
This commit is contained in:
rhjr 2026-07-28 14:56:17 -04:00
parent 5a5ecf7b0e
commit 20c529c8a8

View File

@ -79,6 +79,9 @@
add-log-mailing-address "rhuibjr.business@gmail.com"
change-log-default-name "CHANGELOG"
compilation-always-kill t
truncate-lines t
indent-line-function 'insert-tab
tab-width 2)
@ -140,10 +143,38 @@ 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)
(defun rhjr/display-compilation-same-window (buffer alist)
"Display BUFFER in the selected window if that window is
already showing a compilation-mode buffer. Otherwise, decline
so display-buffer falls through to the next action."
(when (with-current-buffer (window-buffer (selected-window))
(derived-mode-p 'compilation-mode))
(window--display-buffer buffer (selected-window) 'reuse alist)))
(defun rhjr/display-compilation-right-window (buffer alist)
"Display BUFFER in the window to the right of the fixed
88-column window, without creating new windows."
(unless (one-window-p t)
(let* ((left (or (window-left (selected-window)) (selected-window)))
(right (window-right left)))
(when (window-live-p right)
(window--display-buffer buffer right 'reuse alist)))))
(add-to-list 'display-buffer-alist
'("\\*compilation\\*"
(display-buffer-reuse-window
rhjr/display-compilation-same-window
rhjr/display-compilation-right-window)))
(add-to-list 'display-buffer-alist
'("\\*compilation\\*"
(display-buffer-reuse-window
rhjr/display-compilation-same-window
display-buffer-pop-up-window)))
(setq standard-display-table (or standard-display-table (make-display-table)))
(set-display-table-slot standard-display-table 'truncation ?\s)
(set-display-table-slot standard-display-table 'wrap ?\s)
;;; rhjr/mode
(menu-bar-mode -1)
@ -418,6 +449,5 @@ than following the buffer."
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(cape consult corfu-candidate-overlay dumb-jump gruber-darker-theme
highlight-parentheses hl-todo js2-mode magit orderless
vertico)))
'(cape consult corfu dumb-jump gruber-darker-theme
highlight-parentheses hl-todo magit orderless vertico)))