emacs-lisp/package.el (package-install): Invert the second argument.

This commit is contained in:
Artur Malabarba 2015-02-11 14:53:43 +00:00
parent 517fc7b612
commit 0a66ca36fa
2 changed files with 20 additions and 15 deletions

View file

@ -1221,15 +1221,15 @@ using `package-compute-transaction'."
(mapc #'package-install-from-archive packages))
;;;###autoload
(defun package-install (pkg &optional mark-selected)
(defun package-install (pkg &optional dont-select)
"Install the package PKG.
PKG can be a package-desc or the package name of one the available packages
in an archive in `package-archives'. Interactively, prompt for its name.
If called interactively or if MARK-SELECTED is non-nil, add PKG
to `package-selected-packages'.
If called interactively or if DONT-SELECT nil, add PKG to
`package-selected-packages'.
if PKG is a package-desc and it is already installed, don't try
If PKG is a package-desc and it is already installed, don't try
to install it but still mark it as selected."
(interactive
(progn
@ -1247,11 +1247,11 @@ to install it but still mark it as selected."
(symbol-name (car elt))))
package-archive-contents))
nil t))
t)))
nil)))
(let ((name (if (package-desc-p pkg)
(package-desc-name pkg)
pkg)))
(when (and mark-selected (not (package--user-selected-p name)))
(unless (or dont-select (package--user-selected-p name))
(customize-save-variable 'package-selected-packages
(cons name package-selected-packages))))
(if (package-desc-p pkg)
@ -1276,7 +1276,7 @@ object."
(package-delete
(if (package-desc-p pkg) pkg (cadr (assq pkg package-alist)))
'force 'nosave)
(package-install pkg))
(package-install pkg 'dont-select))
(defun package-strip-rcs-id (str)
"Strip RCS version ID from the version string STR.
@ -1929,7 +1929,7 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
(let ((pkg-desc (button-get button 'package-desc)))
(when (y-or-n-p (format "Install package `%s'? "
(package-desc-full-name pkg-desc)))
(package-install pkg-desc 1)
(package-install pkg-desc nil)
(revert-buffer nil t)
(goto-char (point-min)))))
@ -2427,13 +2427,11 @@ Optional argument NOQUERY non-nil means do not ask the user to confirm."
(mapconcat #'package-desc-full-name
install-list ", ")))))
(mapc (lambda (p)
;; Mark as selected if it's the exact version of a
;; package that's already installed, or if it's not
;; installed at all. Don't mark if it's a new
;; version of an installed package.
(package-install p (or (package-installed-p p)
(not (package-installed-p
(package-desc-name p))))))
;; Don't mark as selected if it's a new version of
;; an installed package.
(package-install p (and (not (package-installed-p p))
(package-installed-p
(package-desc-name p)))))
install-list)))
;; Delete packages, prompting if necessary.
(when delete-list