Fix my last change.
[gnus] / lisp / nnmbox.el
index 38f36c2..5f6ecd1 100644 (file)
   (let ((coding-system-for-write 
         (or nnmbox-file-coding-system-for-write
             nnmbox-file-coding-system)))
-        (save-buffer)))
+    (save-buffer)))
 
 (defun nnmbox-save-active (group-alist active-file)
   (let ((nnmail-active-file-coding-system
   (nnheader-report 'nnmbox "LIST NEWSGROUPS is not implemented."))
 
 (deffoo nnmbox-request-expire-articles
-  (articles newsgroup &optional server force)
+    (articles newsgroup &optional server force)
   (nnmbox-possibly-change-newsgroup newsgroup server)
   (let* ((is-old t)
         rest)
       (nconc rest articles))))
 
 (deffoo nnmbox-request-move-article
-  (article group server accept-form &optional last)
+    (article group server accept-form &optional last)
   (let ((buf (get-buffer-create " *nnmbox move*"))
        result)
     (and
 (defun nnmbox-create-mbox ()
   (when (not (file-exists-p nnmbox-mbox-file))
     (let ((nnmail-file-coding-system
-          nnmbox-file-coding-system-for-write))
+          (or nnmbox-file-coding-system-for-write
+              nnmbox-file-coding-system)))
       (nnmail-write-region 1 1 nnmbox-mbox-file t 'nomesg))))
 
 (defun nnmbox-read-mbox ()
          (when (and (re-search-backward
                      (format "^X-Gnus-Newsgroup: %s:\\([0-9]+\\) "
                              (caar alist)) nil t)
-                    (>= (setq number
-                              (string-to-number
-                               (buffer-substring
-                                (match-beginning 1) (match-end 1))))
-                        (cdadar alist)))
-           (setcdr (cadar alist) (1+ number)))
+                    (> (setq number
+                             (string-to-number
+                              (buffer-substring
+                               (match-beginning 1) (match-end 1))))
+                       (cdadar alist)))
+           (setcdr (cadar alist) number))
          (setq alist (cdr alist)))
 
        (goto-char (point-min))
        (while (re-search-forward delim nil t)
          (setq start (match-beginning 0))
-         (when (not (search-forward "\nX-Gnus-Newsgroup: "
-                                    (save-excursion
-                                      (setq end
-                                            (or
-                                             (and
-                                              (re-search-forward delim nil t)
-                                              (match-beginning 0))
-                                             (point-max))))
-                                    t))
+         (unless (search-forward
+                  "\nX-Gnus-Newsgroup: "
+                  (save-excursion
+                    (setq end
+                          (or
+                           (and
+                            ;; skip to end of headers first, since mail
+                            ;; which has been respooled has additional
+                            ;; "From nobody" lines.
+                            (search-forward "\n\n" nil t)
+                            (re-search-forward delim nil t)
+                            (match-beginning 0))
+                           (point-max))))
+                  t)
            (save-excursion
              (save-restriction
                (narrow-to-region start end)