[emacs] move *compilation* auto-close to own section under Defaults
authorAmin Bandali <amin@gnu.org>
Thu, 30 Aug 2018 22:00:57 +0000 (18:00 -0400)
committerAmin Bandali <amin@gnu.org>
Thu, 30 Aug 2018 22:00:57 +0000 (18:00 -0400)
init.org

index 3f3bc06..8333a57 100644 (file)
--- a/init.org
+++ b/init.org
@@ -608,6 +608,20 @@ Enable =winner-mode=.
 (winner-mode 1)
 #+end_src
 
 (winner-mode 1)
 #+end_src
 
+*** Close =*compilation*= on success
+
+#+begin_src emacs-lisp
+(setq compilation-exit-message-function
+      (lambda (status code msg)
+        "Close the compilation window if successful."
+        ;; if M-x compile exits with 0
+         (when (and (eq status 'exit) (zerop code))
+           (bury-buffer)
+           (delete-window (get-buffer-window (get-buffer "*compilation*"))))
+         ;; return the result of compilation-exit-message-function
+         (cons msg code)))
+#+end_src
+
 ** Bindings
 
 #+begin_src emacs-lisp
 ** Bindings
 
 #+begin_src emacs-lisp
@@ -712,16 +726,6 @@ file.
 (add-to-list
  'safe-local-variable-values
  '(eval add-hook 'after-save-hook #'amin/async-babel-tangle 'append 'local))
 (add-to-list
  'safe-local-variable-values
  '(eval add-hook 'after-save-hook #'amin/async-babel-tangle 'append 'local))
-
-(setq compilation-exit-message-function
-      (lambda (status code msg)
-        "Close the compilation window if successful."
-        ;; if M-x compile exits with 0
-         (when (and (eq status 'exit) (zerop code))
-           (bury-buffer)
-           (delete-window (get-buffer-window (get-buffer "*compilation*"))))
-         ;; return the result of compilation-exit-message-function
-         (cons msg code)))
 #+end_src
 
 *** [[https://magit.vc/][Magit]]
 #+end_src
 
 *** [[https://magit.vc/][Magit]]