2016-11-15 17:28:35 +01:00
|
|
|
#+TITLE: Compilation mode configuration
|
|
|
|
|
2016-12-02 14:39:59 +01:00
|
|
|
#+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
|
|
|
|
|
2016-12-02 14:39:59 +01:00
|
|
|
Don't show the compilation window when compilation starts.
|
2016-11-15 17:28:35 +01:00
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2016-12-02 14:39:59 +01:00
|
|
|
(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
|
|
|
|
|
2016-12-02 14:39:59 +01:00
|
|
|
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
|
2016-12-02 14:39:59 +01:00
|
|
|
(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
|