diff options
author | 2016-12-02 14:39:59 +0100 | |
---|---|---|
committer | 2016-12-02 14:39:59 +0100 | |
commit | 1b439d09a36da09556880287f8b8a3b66e230e8b (patch) | |
tree | 4d301c50c05e87abd0b56c3428d87eb40b911406 /emacs/.emacs.d/init/oni-compilation-init.org | |
parent | a6a88fd424ea806ce89ce6b2aa1e0d6664b918de (diff) | |
download | new-dotfiles-1b439d09a36da09556880287f8b8a3b66e230e8b.tar.gz new-dotfiles-1b439d09a36da09556880287f8b8a3b66e230e8b.zip |
Don’t show compilation buffer unless there are errors
Diffstat (limited to 'emacs/.emacs.d/init/oni-compilation-init.org')
-rw-r--r-- | emacs/.emacs.d/init/oni-compilation-init.org | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/emacs/.emacs.d/init/oni-compilation-init.org b/emacs/.emacs.d/init/oni-compilation-init.org index 2813654..162f7d2 100644 --- a/emacs/.emacs.d/init/oni-compilation-init.org +++ b/emacs/.emacs.d/init/oni-compilation-init.org @@ -1,21 +1,41 @@ #+TITLE: Compilation mode configuration +#+BEGIN_SRC emacs-lisp + (require 'compile) + (require 'shackle) + (require 'subr-x) +#+END_SRC + Scroll output in compilation mode. #+BEGIN_SRC emacs-lisp (setq compilation-scroll-output t) #+END_SRC -Show compilation buffers in a side window. +Don't show the compilation window when compilation starts. #+BEGIN_SRC emacs-lisp - (add-to-list 'display-buffer-alist - `(,(rx bos "*compilation*" eos) - display-buffer-in-side-window)) + (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)) #+END_SRC -Bury compilation buffers on successful compilation. +Show the compilation window when compilation has finished with a +non-zero exit status. #+BEGIN_SRC emacs-lisp - (bury-successful-compilation) + (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) #+END_SRC |