dotfiles/emacs/.emacs.d/init/oni-compilation-init.org

42 lines
1.2 KiB
Org Mode
Raw Normal View History

2016-11-15 17:28:35 +01:00
#+TITLE: Compilation mode configuration
#+BEGIN_SRC emacs-lisp
(require 'compile)
(require 'shackle)
(require 'subr-x)
#+END_SRC
2016-11-15 17:28:35 +01:00
Scroll output in compilation mode.
#+BEGIN_SRC emacs-lisp
(setq compilation-scroll-output t)
#+END_SRC
Don't show the compilation window when compilation starts.
2016-11-15 17:28:35 +01:00
#+BEGIN_SRC emacs-lisp
(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))
2016-11-15 17:28:35 +01:00
#+END_SRC
Show the compilation window when compilation has finished with a
non-zero exit status.
2016-11-15 17:28:35 +01:00
#+BEGIN_SRC emacs-lisp
(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)
2016-11-15 17:28:35 +01:00
#+END_SRC