diff options
-rw-r--r-- | emacs/.emacs.d/init.org | 11 | ||||
-rw-r--r-- | emacs/.emacs.d/init/oni-compilation-init.org | 32 |
2 files changed, 36 insertions, 7 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index b0162eb..20898bb 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -477,6 +477,15 @@ To start off, first I need to enable lexical binding. (add-hook 'minibuffer-setup-hook 'electric-pair-local-mode) #+END_SRC +* Shackle + + Shackle is an abstraction over =display-buffer-alist=. + + #+BEGIN_SRC emacs-lisp + (require 'shackle) + (shackle-mode) + #+END_SRC + * Libraries - [[file:init/oni-shr-init.org][shr]] @@ -753,7 +762,7 @@ To start off, first I need to enable lexical binding. - [[file:init/oni-compilation-init.org][compilation-mode]] #+BEGIN_SRC emacs-lisp - (with-eval-after-load 'compilation (load "oni-compilation-init")) + (with-eval-after-load 'compile (load "oni-compilation-init")) #+END_SRC ** Inferior Emacs lisp mode (ielm) 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 |