1.2 KiB
1.2 KiB
Compilation mode configuration
(require 'compile)
(require 'shackle)
(require 'subr-x)
Scroll output in compilation mode.
(setq compilation-scroll-output t)
Don't show the compilation window when compilation starts.
(defun oni:maybe-dont-show-window (buffer-or-name alist plist)
"Don't show BUFFER-OR-NAME unless it absolutely must."
(if (alist-get 'allow-no-window alist)
buffer-or-name
(funcall (plist-get plist :fallback) buffer-or-name alist
(plist-put (copy-sequence plist) :custom nil))))
(add-to-list 'shackle-rules
'(compilation-mode :custom oni:maybe-dont-show-window
:fallback shackle-display-buffer
:other t :select t))
Show the compilation window when compilation has finished with a non-zero exit status.
(defun oni:maybe-display-compilation-window (buffer status)
"Display BUFFER if STATUS is not finished."
(unless (string= (string-trim status) "finished")
(display-buffer buffer)))
(add-hook 'compilation-finish-functions #'oni:maybe-display-compilation-window)