* gnus-agent.el (gnus-agent-fetch-articles): Don't save empty articles.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Sun, 27 Jan 2002 15:18:39 +0000 (15:18 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Sun, 27 Jan 2002 15:18:39 +0000 (15:18 +0000)
lisp/ChangeLog
lisp/gnus-agent.el

index 2ca5660..f73bfef 100644 (file)
@@ -1,3 +1,7 @@
+2002-01-27  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * gnus-agent.el (gnus-agent-fetch-articles): Don't save empty articles.
+
 2002-01-27  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-util.el (gnus-cache-file-contents): Don't use equalp. 
index a7bbe9e..70e6e24 100644 (file)
@@ -944,33 +944,35 @@ the actual number of articles toggled is returned."
          (while pos
            (narrow-to-region (cdar pos) (or (cdadr pos) (point-max)))
            (goto-char (point-min))
-           (when (search-forward "\n\n" nil t)
-             (when (search-backward "\nXrefs: " nil t)
-               ;; Handle crossposting.
-               (skip-chars-forward "^ ")
-               (skip-chars-forward " ")
-               (setq crosses nil)
-               (while (looking-at "\\([^: \n]+\\):\\([0-9]+\\) +")
-                 (push (cons (buffer-substring (match-beginning 1)
-                                               (match-end 1))
-                             (buffer-substring (match-beginning 2)
-                                               (match-end 2)))
-                       crosses)
-                 (goto-char (match-end 0)))
-               (gnus-agent-crosspost crosses (caar pos))))
-           (goto-char (point-min))
-           (if (not (re-search-forward "^Message-ID: *<\\([^>\n]+\\)>" nil t))
-               (setq id "No-Message-ID-in-article")
-             (setq id (buffer-substring (match-beginning 1) (match-end 1))))
-           (let ((coding-system-for-write
-                  gnus-agent-file-coding-system))
-             (write-region (point-min) (point-max)
-                           (concat dir (number-to-string (caar pos)))
-                           nil 'silent))
-           (when (setq elem (assq (caar pos) gnus-agent-article-alist))
-             (setcdr elem t))
-           (gnus-agent-enter-history
-            id (or crosses (list (cons group (caar pos)))) date)
+           (unless (eobp)  ;; Don't save empty articles.
+             (when (search-forward "\n\n" nil t)
+               (when (search-backward "\nXrefs: " nil t)
+                 ;; Handle cross posting.
+                 (skip-chars-forward "^ ")
+                 (skip-chars-forward " ")
+                 (setq crosses nil)
+                 (while (looking-at "\\([^: \n]+\\):\\([0-9]+\\) +")
+                   (push (cons (buffer-substring (match-beginning 1)
+                                                 (match-end 1))
+                               (buffer-substring (match-beginning 2)
+                                                 (match-end 2)))
+                         crosses)
+                   (goto-char (match-end 0)))
+                 (gnus-agent-crosspost crosses (caar pos))))
+             (goto-char (point-min))
+             (if (not (re-search-forward 
+                       "^Message-ID: *<\\([^>\n]+\\)>" nil t))
+                 (setq id "No-Message-ID-in-article")
+               (setq id (buffer-substring (match-beginning 1) (match-end 1))))
+             (let ((coding-system-for-write
+                    gnus-agent-file-coding-system))
+               (write-region (point-min) (point-max)
+                             (concat dir (number-to-string (caar pos)))
+                             nil 'silent))
+             (when (setq elem (assq (caar pos) gnus-agent-article-alist))
+               (setcdr elem t))
+             (gnus-agent-enter-history
+              id (or crosses (list (cons group (caar pos)))) date))
            (widen)
            (pop pos)))
        (gnus-agent-save-alist group)))))