[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Show *compilation* only if build did not succeed
From: |
Amin Bandali |
Subject: |
Re: Show *compilation* only if build did not succeed |
Date: |
Sat, 22 Dec 2018 12:52:06 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
On 2018-12-22 11:49 AM, Stefan Monnier wrote:
>
> Yes: the two replacements suggested by the warning.
>
Thanks for the reply, Stefan. I had already tried both, but for some
reason I could not get it to work. I gave it another shot, and it seems
like I got it right this time around.
For future reference, here’s what I ended up with in my config:
#+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-macs)
(defadvice compilation-start
(around inhibit-display
(command &optional mode name-function highlight-regexp))
(if (not (string-match "^\\(find\\|grep\\)" command))
(cl-letf (((symbol-function 'display-buffer) #'ignore)
((symbol-function 'set-window-point) #'ignore)
((symbol-function 'goto-char) #'ignore))
(save-window-excursion ad-do-it))
ad-do-it))
(ad-activate 'compilation-start)
#+end_src
Best,
amin