I use the compilation-finish-functions
hook to perform some actions once compilation finishes. However, unexpectedly to me the hook is also triggered when rgrep
completes.
I can't seem to find a more appropriate hook for what I'm after, namely a hook that is triggered only when compile
's compilation completes.
Is there such a hook or must I take this into consideration in my hooked functions?
This is how I hook my function (Emacs 25.1.1):
(defun display-piped-output (buffer msg)
(unless (string-match "^finished" msg)
(switch-to-buffer "test.log")))
(define-minor-mode moscow-compilation-mode
"Expect compilation output piped to file"
:global t
(if moscow-compilation-mode
(add-hook 'compilation-finish-functions 'display-piped-output)
(remove-hook 'compilation-finish-functions 'display-piped-output)))
rgrep
is doing this?compilation-finish-functions
is not mentioned anywhere ingrep.el
.emacs -Q
). Ifrgrep
does not triggercompilation-finish-functions
, bisect your init file recursively until you isolate what's happening.compile
machinery behind the scenes. (And of course, you can do the same thing any time you have a similar use-case.)