elpa: Use `package-delete' to remove packages.

In 24.4, simply removing the package directory is no longer enough. This
will only set the package status to `deleted' but package.el will still
think the package is installed and refuse a re-install. Calling
`package-delete' will ensure the right thing is done.

In 24.3 `package-delete' does only remove the directory so we stick with
that, but loading dired is no longer necessary since emacs 23.2 when
`delete-directory' got the optional RECURSIVE parameter.

* methods/el-get-elpa.el (el-get-elpa-post-remove): Call
  `package-delete' to remove packages.
This commit is contained in:
Rüdiger Sonderfeld 2014-05-16 19:27:51 +02:00 committed by Noam Postavsky
parent bdc2df6ea3
commit 13b9b8afc8

View File

@ -194,10 +194,14 @@ first time.")
(defun el-get-elpa-post-remove (package)
"Do remove the ELPA bits for package, now"
(let ((p-elpa-dir (el-get-elpa-package-directory package)))
(if p-elpa-dir
(dired-delete-file p-elpa-dir 'always)
(message "el-get: could not find ELPA dir for %s." package))))
(let* ((pkg (el-get-as-symbol package))
(descs (cdr (assq pkg package-alist))))
(if (listp descs)
;; 24.4+ case, we have a list of descriptors that we can
;; call `package-delete' on.
(mapc #'package-delete descs)
;; Otherwise, just delete the package directory.
(delete-directory (el-get-elpa-package-directory pkg) 'recursive))))
(add-hook 'el-get-elpa-remove-hook 'el-get-elpa-post-remove)