I've fiddled around a little bit, so tell me if my reasoning is ok.
numeric value of '1'. Reading the Emacs Lisp Reference Manual,
I didn't find a way to negate the boolean value with `interactive'. As a matter
of fact I would suggest that `dont-query' must not be a good name since its value
to be queried in that case.
I made my modification with `prompt-user' as a parameter name.
One could think as another alternative, such as `query-user'.
Would it be more appropriate? I can't tell which one sounds better actually.
I am not fluent in english.. :-/
=== modified file 'lisp/emacs-lisp/package.el'
--- lisp/emacs-lisp/package.el 2013-01-01 09:11:05 +0000
+++ lisp/emacs-lisp/package.el 2013-02-04 17:17:41 +0000
@@ -1588,11 +1588,11 @@
(length upgrades)
(if (= (length upgrades) 1) "" "s")))))
-(defun package-menu-execute ()
+(defun package-menu-execute (&optional prompt-user)
"Perform marked Package Menu actions.
Packages marked for installation are downloaded and installed;
packages marked for deletion are removed."
- (interactive)
+ (interactive "p")
(unless (derived-mode-p 'package-menu-mode)
(error "The current buffer is not in Package Menu mode"))
(let (install-list delete-list cmd id)
@@ -1611,26 +1611,30 @@
(push (car id) install-list))))
(forward-line)))
(when install-list
- (if (yes-or-no-p
- (if (= (length install-list) 1)
- (format "Install package `%s'? " (car install-list))
- (format "Install these %d packages (%s)? "
- (length install-list)
- (mapconcat 'symbol-name install-list ", "))))
+ (if (or
+ (not prompt-user)
+ (yes-or-no-p
+ (if (= (length install-list) 1)
+ (format "Install package `%s'? " (car install-list))
+ (format "Install these %d packages (%s)? "
+ (length install-list)
+ (mapconcat 'symbol-name install-list ", ")))))
(mapc 'package-install install-list)))
;; Delete packages, prompting if necessary.
(when delete-list
- (if (yes-or-no-p
- (if (= (length delete-list) 1)
- (format "Delete package `%s-%s'? "
- (caar delete-list)
- (cdr (car delete-list)))
- (format "Delete these %d packages (%s)? "
- (length delete-list)
- (mapconcat (lambda (elt)
- (concat (car elt) "-" (cdr elt)))
- delete-list
- ", "))))
+ (if (or
+ (not prompt-user)
+ (yes-or-no-p
+ (if (= (length delete-list) 1)
+ (format "Delete package `%s-%s'? "
+ (caar delete-list)
+ (cdr (car delete-list)))
+ (format "Delete these %d packages (%s)? "
+ (length delete-list)
+ (mapconcat (lambda (elt)
+ (concat (car elt) "-" (cdr elt)))
+ delete-list
+ ", ")))))
(dolist (elt delete-list)
(condition-case-unless-debug err
(package-delete (car elt) (cdr elt))
prompted then he must reply 'yes'.
"* emacs-lisp/package.el(package-menu-execute): Don't prompt for the user when `package-menu-execute' is called non-interactively."
Tell me if I forget something, or if something is wrong for you.