[emacs] don’t show compilation window in amin/async-babel-tangle
[~bandali/configs] / init.org
index b144736..cd210db 100644 (file)
--- a/init.org
+++ b/init.org
@@ -646,35 +646,18 @@ Enable =winner-mode=.
 (winner-mode 1)
 #+end_src
 
-*** Don’t display =*compilation*= on success
-
-From https://stackoverflow.com/a/17788551.
+*** COMMENT Close =*compilation*= on success
 
 #+begin_src emacs-lisp
-(defun amin--compilation-finish-function (buffer outstr)
-  (unless (string-match "finished" outstr)
-    (switch-to-buffer-other-window buffer))
-  t)
-
-(setq compilation-finish-functions #'amin--compilation-finish-function)
-
-(require 'cl)
-
-(defadvice compilation-start
-    (around inhibit-display
-            (command &optional mode name-function highlight-regexp))
-  (if (not (string-match "^\\(find\\|grep\\)" command))
-      (flet ((display-buffer)
-             (set-window-point)
-             (goto-char))
-        (fset 'display-buffer   'ignore)
-        (fset 'goto-char        'ignore)
-        (fset 'set-window-point 'ignore)
-        (save-window-excursion
-          ad-do-it))
-    ad-do-it))
-
-(ad-activate 'compilation-start)
+(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
 
 *** Search for non-ASCII characters
@@ -844,7 +827,8 @@ file.
                                                                   ',file-tangle-start-time)))
                              ""))
                   (when amin-async-tangle-post-compile
-                    (compile amin-async-tangle-post-compile)))
+                    (save-window-excursion
+                      (compile amin-async-tangle-post-compile))))
               (message "Tangling %s failed" ,file-nodir))))))))
 
 (add-to-list
@@ -1553,6 +1537,23 @@ treemacs
   :after (treemacs))
 #+end_src
 
+** geiser
+
+#+begin_src emacs-lisp
+(use-package geiser)
+
+(use-package geiser-guile
+  :config
+  (setq geiser-guile-load-path "~/src/git/guix"))
+#+end_src
+
+** guix
+
+#+begin_src emacs-lisp
+(use-package guix
+  :load-path "lib/guix/elisp")
+#+end_src
+
 * Emacs Enhancements
 
 ** [[https://github.com/justbur/emacs-which-key][which-key]]
@@ -1984,8 +1985,10 @@ Hopefully temporary.
  read-mail-command   'gnus)
 
 (use-package gnus
-  :bind (("s-m" . gnus)
-         ("s-M" . gnus-unplugged))
+  :bind (("C-c m" . gnus)
+         ("C-c M" . gnus-unplugged)
+         ("s-m"   . gnus)
+         ("s-M"   . gnus-unplugged))
   :init
   (setq
    gnus-select-method '(nnnil "")
@@ -2269,4 +2272,5 @@ Display how long it took to load the init file.
 * COMMENT Local Variables                                           :ARCHIVE:
 # Local Variables:
 # eval: (add-hook 'after-save-hook #'amin/async-babel-tangle 'append 'local)
+# eval: (typo-mode -1)
 # End: