summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2018-08-14 09:06:43 -0700
committerGlenn Morris <rgm@gnu.org>2018-08-14 09:06:43 -0700
commitd113142a8b8c815ecd6ff1418694cb878db5f45c (patch)
tree633f01eefae0388b9cae7b7b2169abe8b2ebb660 /lisp/emacs-lisp
parent396a33a3656a0e2bbe2f24a81df64914491c44e5 (diff)
parent614cc65f2dae346b2e30326cd5de01f891933eed (diff)
downloademacs-d113142a8b8c815ecd6ff1418694cb878db5f45c.tar.gz
emacs-d113142a8b8c815ecd6ff1418694cb878db5f45c.tar.bz2
emacs-d113142a8b8c815ecd6ff1418694cb878db5f45c.zip
Merge from origin/emacs-26
614cc65 ; * lisp/simple.el (line-move-visual): Fix typo. d2ad4ba Do not consider external packages to be removable (Bug#27822) ec0995c * src/alloc.c: Remove obsolete comments. ec6f588 Better support utf-8-with-signature and utf-8-hfs in HTML eb026a8 Don't use -Wabi compiler option
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/package.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 362335220f0..cacc8b0c18c 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1754,6 +1754,15 @@ if it is still empty."
(indirect indirect-deps)
(t (delete-dups (append direct-deps indirect-deps))))))
+(defun package--user-installed-p (package)
+ "Return non-nil if PACKAGE is a user-installed package.
+PACKAGE is the package name, a symbol. Check whether the package
+was installed into `package-user-dir' where we assume to have
+control over."
+ (let* ((pkg-desc (cadr (assq package package-alist)))
+ (dir (package-desc-dir pkg-desc)))
+ (file-in-directory-p dir package-user-dir)))
+
(defun package--removable-packages ()
"Return a list of names of packages no longer needed.
These are packages which are neither contained in
@@ -1763,7 +1772,9 @@ These are packages which are neither contained in
;; `p' and its dependencies are needed.
append (cons p (package--get-deps p)))))
(cl-loop for p in (mapcar #'car package-alist)
- unless (memq p needed)
+ unless (or (memq p needed)
+ ;; Do not auto-remove external packages.
+ (not (package--user-installed-p p)))
collect p)))
(defun package--used-elsewhere-p (pkg-desc &optional pkg-list all)