changeset 108855:8661a29f6131

Synch with Gnus trunk. (gnus-article-browse-delete-temp-files): Don't make query for each temp file when gnus-article-browse-delete-temp is ask.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Wed, 02 Jun 2010 00:10:42 +0000
parents 36500bfff4e8
children b31557c10743 bffeeada2cff
files lisp/gnus/ChangeLog lisp/gnus/gnus-art.el
diffstat 2 files changed, 26 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Tue Jun 01 22:51:36 2010 +0000
+++ b/lisp/gnus/ChangeLog	Wed Jun 02 00:10:42 2010 +0000
@@ -1,3 +1,8 @@
+2010-06-02  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-art.el (gnus-article-browse-delete-temp-files): Don't make query
+	for each temp file when gnus-article-browse-delete-temp is ask.
+
 2010-05-20  Kevin Ryde  <user42@zip.com.au>
 
 	* gnus-start.el (gnus-level-unsubscribed): Doc fix.  (Bug#6206)
--- a/lisp/gnus/gnus-art.el	Tue Jun 01 22:51:36 2010 +0000
+++ b/lisp/gnus/gnus-art.el	Wed Jun 02 00:10:42 2010 +0000
@@ -2806,22 +2806,28 @@
 (defun gnus-article-browse-delete-temp-files (&optional how)
   "Delete temp-files created by `gnus-article-browse-html-parts'."
   (when (and gnus-article-browse-html-temp-list
-	     (or how
-		 (setq how gnus-article-browse-delete-temp)))
-    (when (and (eq how 'ask)
-	       (gnus-y-or-n-p (format
-			       "Delete all %s temporary HTML file(s)? "
-			       (length gnus-article-browse-html-temp-list)))
-	       (setq how t)))
+	     (progn
+	       (or how (setq how gnus-article-browse-delete-temp))
+	       (if (eq how 'ask)
+		   (let ((files (length gnus-article-browse-html-temp-list)))
+		     (gnus-y-or-n-p (format
+				     "Delete all %s temporary HTML file%s? "
+				     files
+				     (if (> files 1) "s" ""))))
+		 how)))
     (dolist (file gnus-article-browse-html-temp-list)
-      (when (and (file-exists-p file)
-		 (or (eq how t)
-		     ;; `how' is neither `nil', `ask' nor `t' (i.e. `file'):
-		     (gnus-y-or-n-p
-		      (format "Delete temporary HTML file `%s'? " file))))
-	(if (file-directory-p file)
-	    (gnus-delete-directory file)
-	  (delete-file file))))
+      (cond ((file-directory-p file)
+	     (when (or (not (eq how 'file))
+		       (gnus-y-or-n-p
+			(format
+			 "Delete temporary HTML file(s) in directory `%s'? "
+			 (file-name-as-directory file))))
+	       (gnus-delete-directory file)))
+	    ((file-exists-p file)
+	     (when (or (not (eq how 'file))
+		       (gnus-y-or-n-p
+			(format "Delete temporary HTML file `%s'? " file)))
+	       (delete-file file)))))
     ;; Also remove file from the list when not deleted or if file doesn't
     ;; exist anymore.
     (setq gnus-article-browse-html-temp-list nil))