diff options
author | Amin Bandali <bandali@gnu.org> | 2018-12-22 02:37:49 -0500 |
---|---|---|
committer | Amin Bandali <bandali@gnu.org> | 2018-12-22 02:37:49 -0500 |
commit | c44ace121a47611a449c8755506f6bb5eeaf1336 (patch) | |
tree | 97c029d186be10187e7a3701e2189c21b2566302 | |
parent | 5492a3dccda6c6a91c7ac784d85d2d7f0e1501d5 (diff) | |
download | configs-c44ace121a47611a449c8755506f6bb5eeaf1336.tar.gz configs-c44ace121a47611a449c8755506f6bb5eeaf1336.tar.xz configs-c44ace121a47611a449c8755506f6bb5eeaf1336.zip |
Revert "[emacs] don’t display *compilation* on successful builds"
This reverts commit 74a56f48afc4f55b7989cb6f1b3e84b0ce8e0878.
-rw-r--r-- | init.org | 41 |
1 files changed, 12 insertions, 29 deletions
@@ -646,35 +646,18 @@ Enable =winner-mode=. (winner-mode 1) #+end_src -*** Don’t display =*compilation*= on success - -From https://stackoverflow.com/a/17788551. - -#+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) +*** 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 *** Search for non-ASCII characters |