]> git.eshelyaron.com Git - emacs.git/commitdiff
emacs-lisp/package.el (package-delete): Don't always delesect.
authorArtur Malabarba <bruce.connor.am@gmail.com>
Thu, 5 Feb 2015 22:47:28 +0000 (20:47 -0200)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Thu, 5 Feb 2015 22:47:28 +0000 (20:47 -0200)
lisp/ChangeLog
lisp/emacs-lisp/package.el

index 37e922aafbcb25f14c403f21c5383644375887b5..b24b2afb0b8c4e9d0004031ebdd9e8307ff3a792 100644 (file)
@@ -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  <monnier@iro.umontreal.ca>
 
index f11790693b987300172473d5022e7d64d0b2f825..f19cca571e43a4ba3c387c361e65df53bef9f794 100644 (file)
@@ -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