From 70550acf88e5d7083d3aa83d201a8a7ebc3ba4b6 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Sat, 28 Jan 2012 17:49:29 +0800 Subject: [PATCH] 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 --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/package.el | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 887959d2fe0..896f7ce9a97 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-01-28 Phil Hagelberg + + * emacs-lisp/package.el (package-install): Run + package-refresh-contents if there is no archive yet (Bug#97978). + 2012-01-28 Chong Yidong * emacs-lisp/package.el (package-maybe-load-descriptor): New diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 7e56c5534ec..317fa1fd23d 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -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) -- 2.39.2