Merge pull request from danielpza/add-update-custom-package

GitHub-reference: https://github.com/jwiegley/use-package/issues/930
This commit is contained in:
John Wiegley 2022-08-07 08:28:07 -07:00 committed by GitHub
commit 015c921a2e

View file

@ -25,6 +25,8 @@
(eval-when-compile (eval-when-compile
(declare-function system-packages-get-command "system-packages")) (declare-function system-packages-get-command "system-packages"))
(defvar use-package-ensure-system-package--custom-packages '()
"List of custom packages installed.")
(defun use-package-ensure-system-package-consify (arg) (defun use-package-ensure-system-package-consify (arg)
"Turn `arg' into a cons of (`package-name' . `install-command')." "Turn `arg' into a cons of (`package-name' . `install-command')."
@ -38,11 +40,18 @@
((not (cdr arg)) ((not (cdr arg))
(use-package-ensure-system-package-consify (car arg))) (use-package-ensure-system-package-consify (car arg)))
((stringp (cdr arg)) ((stringp (cdr arg))
(cons (car arg) `(async-shell-command ,(cdr arg)))) (progn
(push (cdr arg) use-package-ensure-system-package--custom-packages)
(cons (car arg) `(async-shell-command ,(cdr arg)))))
(t (t
(cons (car arg) (cons (car arg)
`(system-packages-install ,(symbol-name (cdr arg))))))))) `(system-packages-install ,(symbol-name (cdr arg)))))))))
(defun use-package-ensure-system-package-update-custom-packages ()
(interactive)
(dolist (cmd use-package-ensure-system-package--custom-packages)
(async-shell-command cmd)))
;;;###autoload ;;;###autoload
(defun use-package-normalize/:ensure-system-package (_name-symbol keyword args) (defun use-package-normalize/:ensure-system-package (_name-symbol keyword args)
"Turn `arg' into a list of cons-es of (`package-name' . `install-command')." "Turn `arg' into a list of cons-es of (`package-name' . `install-command')."