1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

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

This commit is contained in:
Chong Yidong 2011-08-26 11:53:50 -04:00
parent d43f5a423d
commit 7254299e4d
2 changed files with 21 additions and 10 deletions

View File

@ -1,3 +1,8 @@
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)

View File

@ -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.