Skip to content

Commit 9d69aa9

Browse files
committed
usab,enh: don't trigger error if helm-make is not available
1 parent 75181f2 commit 9d69aa9

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

cookbook/run-command-recipe-make.el

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,23 @@
1212
(defun run-command-recipe-make ()
1313
"Provide commands to run Makefile targets.
1414
15-
Requires `helm-make' (https://github.com/abo-abo/helm-make) to be installed."
16-
(require 'helm-make)
17-
(when-let* ((project-dir
18-
(locate-dominating-file default-directory "Makefile"))
19-
(makefile (concat project-dir "Makefile"))
20-
(targets (helm--make-cached-targets makefile)))
21-
(seq-map
22-
(lambda (target)
23-
(list
24-
:command-name target
25-
:command-line (concat "make " target)
26-
:display target
27-
:working-dir project-dir))
28-
targets)))
15+
Requires `helm-make' (https://github.com/abo-abo/helm-make) to
16+
read Makefile targets, but does not require `helm' and can be
17+
used with any of the selectors supported by `run-command'."
18+
19+
(when (require 'helm-make nil t)
20+
(when-let* ((project-dir
21+
(locate-dominating-file default-directory "Makefile"))
22+
(makefile (concat project-dir "Makefile"))
23+
(targets (helm--make-cached-targets makefile)))
24+
(seq-map
25+
(lambda (target)
26+
(list
27+
:command-name target
28+
:command-line (concat "make " target)
29+
:display target
30+
:working-dir project-dir))
31+
targets))))
2932

3033
(provide 'run-command-recipe-make)
3134
;;; run-command-recipe-make.el ends here

0 commit comments

Comments
 (0)