Subject: Rép : bug#13625: 24.1; Enable 'package-menu-execute being non-interactive

From: Yves Baumes <[email-masked]>
Date: Tue, 05 Feb 2013 17:38:34 +0100

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: [email-masked]
# target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: 509b0f8920808cc725a441fb32877e16e6ec513f
# timestamp: 2013-02-05 16:34:09 +0100
# source_branch: bzr://bzr.savannah.gnu.org/emacs/trunk
# base_revision_id: [email-masked]
# 
# Begin patch
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2013-02-05 12:16:35 +0000
+++ lisp/ChangeLog	2013-02-05 15:32:37 +0000
@@ -1,3 +1,8 @@
+2013-02-05  Yves Baumes  <[email-masked]>
+
+	* lisp/emacs-lisp/package.el (package-menu-execute): Don't query
+	for the user input when called non-interactively (bug#13625).
+
 2013-02-05  Jan Djärv  <[email-masked]>
 
 	* cus-start.el (all): Add ns-use-native-fullscreen.

=== 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-05 15:32:37 +0000
@@ -1588,7 +1588,7 @@
 	       (length upgrades)
 	       (if (= (length upgrades) 1) "" "s")))))
 
-(defun package-menu-execute ()
+(defun package-menu-execute (&optional dont-query)
   "Perform marked Package Menu actions.
 Packages marked for installation are downloaded and installed;
 packages marked for deletion are removed."
@@ -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
+           dont-query
+           (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
+           dont-query
+           (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))

# Begin bundle
YjGA

Attached is a bzr bundle for the modifications.

Regards
Yves