From 475bb02345c0ef296ceaac70c951ae8e0eeace1f Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 26 Apr 2026 23:13:41 +0200 Subject: [PATCH] Do not regard selected packages as removable * lisp/emacs-lisp/package.el (package--removable-packages): Handle the fact that 'package--dependencies' doesn't return the package itself as a dependency, so we have to check 'package-selected-packages' separately. Also fix the way we check the return value of 'package--dependencies', keeping in mind that the value is an alist. (Bug#80907) --- lisp/emacs-lisp/package.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 2453e181858..93fdc81164f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1869,7 +1869,8 @@ These are packages which are neither contained in `package-selected-packages' nor a dependency of one that is." (let ((needed (package--dependencies package-selected-packages))) (cl-loop for (name . descs) in (package--alist) - unless (or (memq name needed) + unless (or (assq name needed) + (memq name package-selected-packages) ;; Do not auto-remove external packages. (not (package--user-installed-p name))) append descs)))