changeset 110425:cd99c4421df9

* lisp/gnus/nnml.el (nnml-files): Add prefix to dynamic var `files'. (nnml-generate-nov-databases-directory, nnml-generate-active-info): Update var name. (nnml-generate-nov-file): Use dolist. (nnml-directory-articles, nnml-current-group-article-to-file-alist): Use with-current-buffer.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 19 Sep 2010 11:16:28 +0200
parents 03a492f2d1ce
children cd8d9630f156
files lisp/gnus/ChangeLog lisp/gnus/nnml.el
diffstat 2 files changed, 23 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Sat Sep 18 22:11:18 2010 -0400
+++ b/lisp/gnus/ChangeLog	Sun Sep 19 11:16:28 2010 +0200
@@ -1,3 +1,12 @@
+2010-09-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* nnml.el (nnml-files): Add prefix to dynamic var `files'.
+	(nnml-generate-nov-databases-directory, nnml-generate-active-info):
+	Update var name.
+	(nnml-generate-nov-file): Use dolist.
+	(nnml-directory-articles, nnml-current-group-article-to-file-alist):
+	Use with-current-buffer.
+
 2010-09-18  Julien Danjou  <julien@danjou.info>
 
 	* gnus-html.el (gnus-html-schedule-image-fetching): Fetch all images in
@@ -9,7 +18,7 @@
 	the range update right.
 	(nnimap-request-group): Don't make `M-g' bug out on group with no
 	marks.
-	(nnoo): Required, so that other packages can require nnimap.
+	(nnoo): Require, so that other packages can require nnimap.
 	(nnimap-wait-for-response): Be a bit more lax in finding the end of the
 	command we're looking for.  This helps when the server sends more
 	responses after we've gotten everything we expected.
--- a/lisp/gnus/nnml.el	Sat Sep 18 22:11:18 2010 -0400
+++ b/lisp/gnus/nnml.el	Sun Sep 19 11:16:28 2010 +0200
@@ -878,6 +878,7 @@
   ;; Save the active file.
   (nnmail-save-active nnml-group-alist nnml-active-file))
 
+(defvar nnml-files)
 (defun nnml-generate-nov-databases-directory (dir &optional seen no-active)
   "Regenerate the NOV database in DIR.
 
@@ -897,9 +898,9 @@
 		   (file-directory-p dir))
 	  (nnml-generate-nov-databases-directory dir seen)))
       ;; Do this directory.
-      (let ((files (sort (nnheader-article-to-file-alist dir)
+      (let ((nnml-files (sort (nnheader-article-to-file-alist dir)
 			 'car-less-than-car)))
-	(if (not files)
+	(if (not nnml-files)
 	    (let* ((group (nnheader-file-to-group
 			   (directory-file-name dir) nnml-directory))
 		   (info (cadr (assoc group nnml-group-alist))))
@@ -907,11 +908,10 @@
 		(setcar info (1+ (cdr info)))))
 	  (funcall nnml-generate-active-function dir)
 	  ;; Generate the nov file.
-	  (nnml-generate-nov-file dir files)
+	  (nnml-generate-nov-file dir nnml-files)
 	  (unless no-active
 	    (nnmail-save-active nnml-group-alist nnml-active-file)))))))
 
-(defvar files)
 (defun nnml-generate-active-info (dir)
   ;; Update the active info for this group.
   (let ((group (directory-file-name dir))
@@ -922,9 +922,9 @@
 	  last (or (caadr entry) 0)
 	  nnml-group-alist (delq entry nnml-group-alist))
     (push (list group
-		(cons (or (caar files) (1+ last))
+		(cons (or (caar nnml-files) (1+ last))
 		      (max last
-			   (or (caar (last files))
+			   (or (caar (last nnml-files))
 			       0))))
 	  nnml-group-alist)))
 
@@ -941,8 +941,8 @@
       ;; Delete the old NOV file.
       (when (file-exists-p nov)
 	(funcall nnmail-delete-file-function nov))
-      (while files
-	(unless (file-directory-p (setq file (concat dir (cdar files))))
+      (dolist (file files)
+	(unless (file-directory-p (setq file (concat dir (cdr file))))
 	  (erase-buffer)
 	  (nnheader-insert-file-contents file)
 	  (narrow-to-region
@@ -953,12 +953,11 @@
 	     (max (point-min) (1- (point)))))
 	  (unless (zerop (buffer-size))
 	    (goto-char (point-min))
-	    (setq headers (nnml-parse-head chars (caar files)))
+	    (setq headers (nnml-parse-head chars (car file)))
 	    (with-current-buffer nov-buffer
 	      (goto-char (point-max))
 	      (nnheader-insert-nov headers)))
-	  (widen))
-	(setq files (cdr files)))
+	  (widen)))
       (with-current-buffer nov-buffer
 	(nnmail-write-region (point-min) (point-max) nov nil 'nomesg)
 	(kill-buffer (current-buffer))))))
@@ -995,11 +994,9 @@
     ;; build list from .overview if available
     ;; We would use nnml-open-nov, except that nnml-nov-buffer-alist is
     ;; defvoo'd, and we might get called when it hasn't been swapped in.
-    (save-excursion
+    (with-current-buffer (nnml-get-nov-buffer nnml-current-group)
       (let ((list nil)
-	    art
-	    (buffer (nnml-get-nov-buffer nnml-current-group)))
-	(set-buffer buffer)
+	    art)
 	(goto-char (point-min))
 	(while (not (eobp))
 	  (setq art (read (current-buffer)))
@@ -1018,11 +1015,9 @@
 				  nnml-current-directory))))
       (nnheader-article-to-file-alist nnml-current-directory)
     ;; build list from .overview if available
-    (save-excursion
+    (with-current-buffer (nnml-get-nov-buffer nnml-current-group)
       (let ((alist nil)
-	    (buffer (nnml-get-nov-buffer nnml-current-group))
 	    art)
-	(set-buffer buffer)
 	(goto-char (point-min))
 	(while (not (eobp))
 	  (setq art (read (current-buffer)))