Commit 7254299e authored by Chong Yidong's avatar Chong Yidong

* package.el (package-install): Call package-initialize if called interactively.

parent d43f5a42
2011-08-26 Chong Yidong <cyd@stupidchicken.com>
* emacs-lisp/package.el (package-install): Call package-initialize
if called interactively.
2011-08-26 Leo Liu <sdl.web@gmail.com>
* emacs-lisp/cl-macs.el (defstruct): Fix format. (Bug#9357)
......
......@@ -852,18 +852,26 @@ using `package-compute-transaction'."
(t
(error "Unknown package kind: %s" (symbol-name kind)))))))
(defvar package--initialized nil)
;;;###autoload
(defun package-install (name)
"Install the package named NAME.
Interactively, prompt for the package name.
The package is found on one of the archives in `package-archives'."
NAME should be the name of one of the available packages in an
archive in `package-archives'. Interactively, prompt for NAME."
(interactive
(list (intern (completing-read "Install package: "
(mapcar (lambda (elt)
(cons (symbol-name (car elt))
nil))
package-archive-contents)
nil t))))
(progn
;; Initialize the package system to get the list of package
;; symbols for completion.
(unless package--initialized
(package-initialize t))
(list (intern (completing-read
"Install package: "
(mapcar (lambda (elt)
(cons (symbol-name (car elt))
nil))
package-archive-contents)
nil t)))))
(let ((pkg-desc (assq name package-archive-contents)))
(unless pkg-desc
(error "Package `%s' is not available for installation"
......@@ -1076,8 +1084,6 @@ makes them available for download."
(car archive)))))
(package-read-all-archive-contents))
(defvar package--initialized nil)
;;;###autoload
(defun package-initialize (&optional no-activate)
"Load Emacs Lisp packages, and activate them.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment