From 2a8c2ffea2073ac0b23d201b6a9c5cf074c86645 Mon Sep 17 00:00:00 2001 From: Justin Talbott Date: Mon, 9 Jul 2018 17:47:42 -0400 Subject: [PATCH] allow :ensure-system-package to check the presence of files at path closes https://github.com/jwiegley/use-package/issues/660 --- lisp/use-package/use-package-ensure-system-package.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/use-package/use-package-ensure-system-package.el b/lisp/use-package/use-package-ensure-system-package.el index 476a4f2b930..eaf6de79a12 100644 --- a/lisp/use-package/use-package-ensure-system-package.el +++ b/lisp/use-package/use-package-ensure-system-package.el @@ -53,13 +53,20 @@ (t (list (use-package-ensure-system-package-consify arg))))))) +(defun use-package-ensure-system-package-exists? (file-or-exe) + "If variable is a string, ensure the file path exists. +If it is a symbol, ensure the binary exist." + (if (stringp file-or-exe) + (file-exists-p file-or-exe) + (executable-find (symbol-name file-or-exe)))) + ;;;###autoload (defun use-package-handler/:ensure-system-package (name _keyword arg rest state) "Execute the handler for `:ensure-system-package' keyword in `use-package'." (let ((body (use-package-process-keywords name rest state))) (use-package-concat (mapcar #'(lambda (cons) - `(unless (executable-find (symbol-name ',(car cons))) + `(unless (use-package-ensure-system-package-exists? ',(car cons)) (async-shell-command ,(cdr cons)))) arg) body))) -- 2.39.2