mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-05 11:49:37 +00:00
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
This commit is contained in:
commit
c169644637
1 changed files with 8 additions and 1 deletions
|
@ -53,13 +53,20 @@
|
||||||
(t
|
(t
|
||||||
(list (use-package-ensure-system-package-consify arg)))))))
|
(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
|
;;;###autoload
|
||||||
(defun use-package-handler/:ensure-system-package (name _keyword arg rest state)
|
(defun use-package-handler/:ensure-system-package (name _keyword arg rest state)
|
||||||
"Execute the handler for `:ensure-system-package' keyword in `use-package'."
|
"Execute the handler for `:ensure-system-package' keyword in `use-package'."
|
||||||
(let ((body (use-package-process-keywords name rest state)))
|
(let ((body (use-package-process-keywords name rest state)))
|
||||||
(use-package-concat
|
(use-package-concat
|
||||||
(mapcar #'(lambda (cons)
|
(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)
|
(async-shell-command ,(cdr cons)))) arg)
|
||||||
body)))
|
body)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue