Skip to content

Commit

Permalink
Fix emacs bug with selected-packages
Browse files Browse the repository at this point in the history
where package-install add pkg to selected package before beeing sure
it has been installed.

* helm-elisp-package.el (helm-elisp-package--pkg-name): New.
(helm-el-package-install-1): Do it.
  • Loading branch information
Thierry Volpiatto committed Apr 12, 2019
1 parent c8746ed commit b92fbc2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions helm-elisp-package.el
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,25 @@
(helm-exit-and-execute-action 'helm-el-package-visit-homepage)))
(put 'helm-el-run-visit-homepage 'helm-only t)

(defun helm-elisp-package--pkg-name (pkg)
(if (package-desc-p pkg)
(package-desc-name pkg)
pkg))

(defun helm-el-package-install-1 (pkg-list)
(cl-loop with mkd = pkg-list
for p in mkd
for id = (get-text-property 0 'tabulated-list-id p)
for pkg = (if (fboundp 'package-desc-name) id (car id))
do (package-install pkg)
collect pkg into installed-list
for name = (helm-elisp-package--pkg-name pkg)
do (package-install pkg t)
when (helm-aand (assq name package-alist)
(package-desc-dir (cadr it))
(file-exists-p it))
collect pkg into installed-list and
do (unless (package--user-selected-p name)
(package--save-selected-packages
(cons name package-selected-packages)))
finally do (if (fboundp 'package-desc-full-name)
(message (format "%d packages installed:\n(%s)"
(length installed-list)
Expand Down

0 comments on commit b92fbc2

Please sign in to comment.