Only make TAGS when TAGS target available

The "(Shell command failed with code 2 and no output)" was starting to
drive me nuts.

* .emacs.d/site-lisp/oni.el (oni:after-save-func): Check if there is a
  `TAGS:' target in the found makefile before trying to make.
This commit is contained in:
Tom Willemsen 2012-12-19 11:29:46 +01:00
parent c8b34bbdad
commit 19cc94fc81

View file

@ -68,8 +68,10 @@ DOT are intentionally being skipped."
"Function for `after-save-hook'." "Function for `after-save-hook'."
(oni:compile-el) (oni:compile-el)
(executable-make-buffer-file-executable-if-script-p) (executable-make-buffer-file-executable-if-script-p)
(let ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile"))) (let* ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile"))
(when dom-dir (TAGSp (not (string= "" (shell-command-to-string
(concat "grep \"^TAGS:\" " dom-dir "Makefile"))))))
(when (and dom-dir TAGSp)
(shell-command (shell-command
(concat "make -C " dom-dir " TAGS >/dev/null 2>&1"))))) (concat "make -C " dom-dir " TAGS >/dev/null 2>&1")))))