From 3e2377ce2f4eeb141ffbd000723c55813f78b08f Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 25 Mar 2014 00:38:06 +0200 Subject: [PATCH] Fix bug#16762 * lisp/emacs-lisp/package.el (package--add-to-archive-contents): Include already installed and built-in packages in `package-archive-contents'. (package-install): Don't include already installed packages in the options on interactive invocation. --- lisp/ChangeLog | 8 ++++++++ lisp/emacs-lisp/package.el | 18 ++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 20b0a98f8d7..667b85729d7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2014-03-24 Dmitry Gutov + + * emacs-lisp/package.el (package--add-to-archive-contents): + Include already installed and built-in packages in + `package-archive-contents'. + (package-install): Don't include already installed packages in the + options during interactive invocation. (Bug#16762) + 2014-03-24 Daniel Colascione * emacs-lisp/cl-macs.el (cl--do-arglist): Use `plist-member' diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 39cfd8e46ec..49366cffc22 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1047,14 +1047,9 @@ Also, add the originating archive to the `package-desc' structure." (existing-packages (assq name package-archive-contents)) (pinned-to-archive (assoc name package-pinned-packages))) (cond - ;; Skip entirely if pinned to another archive or already installed. - ((or (and pinned-to-archive - (not (equal (cdr pinned-to-archive) archive))) - (let ((bi (assq name package--builtin-versions))) - (and bi (version-list-= version (cdr bi)))) - (let ((ins (cdr (assq name package-alist)))) - (and ins (version-list-= version - (package-desc-version (car ins)))))) + ;; Skip entirely if pinned to another archive. + ((and pinned-to-archive + (not (equal (cdr pinned-to-archive) archive))) nil) ((not existing-packages) (push (list name pkg-desc) package-archive-contents)) @@ -1090,8 +1085,11 @@ in an archive in `package-archives'. Interactively, prompt for its name." (package-refresh-contents)) (list (intern (completing-read "Install package: " - (mapcar (lambda (elt) (symbol-name (car elt))) - package-archive-contents) + (delq nil + (mapcar (lambda (elt) + (unless (package-installed-p (car elt)) + (symbol-name (car elt)))) + package-archive-contents)) nil t))))) (package-download-transaction (if (package-desc-p pkg) -- 2.39.2