diff options
| author | John Wiegley | 2018-07-10 00:29:34 -0700 |
|---|---|---|
| committer | GitHub | 2018-07-10 00:29:34 -0700 |
| commit | c169644637ea78cd810aa6c7db35accb9d0d58d5 (patch) | |
| tree | 509738a35ac1e341e0fe35089bb65ae9142eeb88 | |
| parent | 0a4d08205434a4ca2dd6033154172b406e67127c (diff) | |
| parent | 2a8c2ffea2073ac0b23d201b6a9c5cf074c86645 (diff) | |
| download | emacs-c169644637ea78cd810aa6c7db35accb9d0d58d5.tar.gz emacs-c169644637ea78cd810aa6c7db35accb9d0d58d5.zip | |
Merge pull request from jwiegley/ensure-system-package-filepath
allow :ensure-system-package to check the presence of files at path
GitHub-reference: https://github.com/jwiegley/use-package/issues/703
| -rw-r--r-- | lisp/use-package/use-package-ensure-system-package.el | 9 |
1 files changed, 8 insertions, 1 deletions
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 @@ | |||
| 53 | (t | 53 | (t |
| 54 | (list (use-package-ensure-system-package-consify arg))))))) | 54 | (list (use-package-ensure-system-package-consify arg))))))) |
| 55 | 55 | ||
| 56 | (defun use-package-ensure-system-package-exists? (file-or-exe) | ||
| 57 | "If variable is a string, ensure the file path exists. | ||
| 58 | If it is a symbol, ensure the binary exist." | ||
| 59 | (if (stringp file-or-exe) | ||
| 60 | (file-exists-p file-or-exe) | ||
| 61 | (executable-find (symbol-name file-or-exe)))) | ||
| 62 | |||
| 56 | ;;;###autoload | 63 | ;;;###autoload |
| 57 | (defun use-package-handler/:ensure-system-package (name _keyword arg rest state) | 64 | (defun use-package-handler/:ensure-system-package (name _keyword arg rest state) |
| 58 | "Execute the handler for `:ensure-system-package' keyword in `use-package'." | 65 | "Execute the handler for `:ensure-system-package' keyword in `use-package'." |
| 59 | (let ((body (use-package-process-keywords name rest state))) | 66 | (let ((body (use-package-process-keywords name rest state))) |
| 60 | (use-package-concat | 67 | (use-package-concat |
| 61 | (mapcar #'(lambda (cons) | 68 | (mapcar #'(lambda (cons) |
| 62 | `(unless (executable-find (symbol-name ',(car cons))) | 69 | `(unless (use-package-ensure-system-package-exists? ',(car cons)) |
| 63 | (async-shell-command ,(cdr cons)))) arg) | 70 | (async-shell-command ,(cdr cons)))) arg) |
| 64 | body))) | 71 | body))) |
| 65 | 72 | ||