Fix M-x package-install failure if no archive has been fetched yet.

* emacs-lisp/package.el (package-install): Run
package-refresh-contents if there is no archive yet.

Fixes: debbugs:97978
This commit is contained in:
Phil Hagelberg 2012-01-28 17:49:29 +08:00 committed by Chong Yidong
parent 0ce8e868b9
commit 70550acf88
2 changed files with 7 additions and 0 deletions

View file

@ -889,6 +889,8 @@ archive in `package-archives'. Interactively, prompt for NAME."
;; symbols for completion.
(unless package--initialized
(package-initialize t))
(unless package-archive-contents
(package-refresh-contents))
(list (intern (completing-read
"Install package: "
(mapcar (lambda (elt)