diff options
| author | Yuri D'Elia | 2018-07-17 12:59:35 +0200 |
|---|---|---|
| committer | Noam Postavsky | 2018-08-11 21:06:26 -0400 |
| commit | d2ad4ba4f3c5db6f6be7d73c17332e9bc4570e29 (patch) | |
| tree | 08b3c715d70af082a9bfa619ec91c50dab9115b5 | |
| parent | ec0995c40901a5b11d42c8a5fafd26771c76b17c (diff) | |
| download | emacs-d2ad4ba4f3c5db6f6be7d73c17332e9bc4570e29.tar.gz emacs-d2ad4ba4f3c5db6f6be7d73c17332e9bc4570e29.zip | |
Do not consider external packages to be removable (Bug#27822)
Packages which are not directly user-installed shouldn't be autoremoved,
since they can be setup through a different path (via
`package-directory-list') where we have no authority over.
* lisp/emacs-lisp/package.el (package--user-installed-p): New
function.
(package--removable-packages): Use it.
| -rw-r--r-- | lisp/emacs-lisp/package.el | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 576a9bc7e73..207c2e5c489 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -1730,6 +1730,15 @@ if it is still empty." | |||
| 1730 | (indirect indirect-deps) | 1730 | (indirect indirect-deps) |
| 1731 | (t (delete-dups (append direct-deps indirect-deps)))))) | 1731 | (t (delete-dups (append direct-deps indirect-deps)))))) |
| 1732 | 1732 | ||
| 1733 | (defun package--user-installed-p (package) | ||
| 1734 | "Return non-nil if PACKAGE is a user-installed package. | ||
| 1735 | PACKAGE is the package name, a symbol. Check whether the package | ||
| 1736 | was installed into `package-user-dir' where we assume to have | ||
| 1737 | control over." | ||
| 1738 | (let* ((pkg-desc (cadr (assq package package-alist))) | ||
| 1739 | (dir (package-desc-dir pkg-desc))) | ||
| 1740 | (file-in-directory-p dir package-user-dir))) | ||
| 1741 | |||
| 1733 | (defun package--removable-packages () | 1742 | (defun package--removable-packages () |
| 1734 | "Return a list of names of packages no longer needed. | 1743 | "Return a list of names of packages no longer needed. |
| 1735 | These are packages which are neither contained in | 1744 | These are packages which are neither contained in |
| @@ -1739,7 +1748,9 @@ These are packages which are neither contained in | |||
| 1739 | ;; `p' and its dependencies are needed. | 1748 | ;; `p' and its dependencies are needed. |
| 1740 | append (cons p (package--get-deps p))))) | 1749 | append (cons p (package--get-deps p))))) |
| 1741 | (cl-loop for p in (mapcar #'car package-alist) | 1750 | (cl-loop for p in (mapcar #'car package-alist) |
| 1742 | unless (memq p needed) | 1751 | unless (or (memq p needed) |
| 1752 | ;; Do not auto-remove external packages. | ||
| 1753 | (not (package--user-installed-p p))) | ||
| 1743 | collect p))) | 1754 | collect p))) |
| 1744 | 1755 | ||
| 1745 | (defun package--used-elsewhere-p (pkg-desc &optional pkg-list all) | 1756 | (defun package--used-elsewhere-p (pkg-desc &optional pkg-list all) |