From: Artur Malabarba Date: Thu, 5 Feb 2015 22:47:28 +0000 (-0200) Subject: emacs-lisp/package.el (package-delete): Don't always delesect. X-Git-Tag: emacs-25.0.90~2008^2~90 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a844b9407496aeaa6945f4611e57e4b0e69ada18;p=emacs.git emacs-lisp/package.el (package-delete): Don't always delesect. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 37e922aafbc..b24b2afb0b8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -5,6 +5,9 @@ (package-menu-execute): Use it to delete packages in order. (package--sort-deps-in-alist): New function. (package-menu-mark-install): Can mark dependencies. + (package--newest-p): New function. + (package-delete): Don't delesect when deleting an older version of + an upgraded package. 2015-02-05 Stefan Monnier diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index f11790693b9..f19cca571e4 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1510,6 +1510,11 @@ with PKG-DESC entry removed." (and (memq pkg (mapcar #'car (package-desc-reqs (cadr p)))) (car p)))))) +(defun package--newest-p (pkg) + "Return t if PKG is the newest package with its name." + (equal (cadr (assq (package-desc-name pkg) package-alist)) + pkg)) + (defun package-delete (pkg-desc &optional force nosave) "Delete package PKG-DESC. @@ -1527,7 +1532,10 @@ If NOSAVE is non-nil, the package is not removed from ;; don't want it marked as selected, so we remove it from ;; `package-selected-packages' even if it can't be deleted. (when (and (null nosave) - (package--user-selected-p name)) + (package--user-selected-p name) + ;; Don't delesect if this is an older version of an + ;; upgraded package. + (package--newest-p pkg-desc)) (customize-save-variable 'package-selected-packages (remove name package-selected-packages))) (cond ((not (string-prefix-p (file-name-as-directory