(gnus-agent-retrieve-headers): Erase buffer.
[gnus] / lisp / nnml.el
index 408c6e5..b7eb5b1 100644 (file)
 (require 'nnoo)
 (eval-when-compile (require 'cl))
 
+(eval-and-compile
+  (autoload 'gnus-article-unpropagatable-p "gnus-sum"))
+
 (nnoo-declare nnml)
 
 (defvoo nnml-directory message-directory
-  "Spool directory for the nnml mail backend.
-
-This variable is a virtual server slot.  See the Gnus manual for details.")
+  "Spool directory for the nnml mail backend.")
 
 (defvoo nnml-active-file
     (expand-file-name "active" nnml-directory)
-  "Mail active file.
-
-This variable is a virtual server slot.  See the Gnus manual for details.")
+  "Mail active file.")
 
 (defvoo nnml-newsgroups-file
     (expand-file-name "newsgroups" nnml-directory)
-  "Mail newsgroups description file.
-
-This variable is a virtual server slot.  See the Gnus manual for details.")
+  "Mail newsgroups description file.")
 
 (defvoo nnml-get-new-mail t
-  "If non-nil, nnml will check the incoming mail file and split the mail.
-
-This variable is a virtual server slot.  See the Gnus manual for details.")
+  "If non-nil, nnml will check the incoming mail file and split the mail.")
 
 (defvoo nnml-nov-is-evil nil
   "If non-nil, Gnus will never generate and use nov databases for mail spools.
@@ -69,9 +64,7 @@ This variable shouldn't be flipped much.  If you have, for some reason,
 set this to t, and want to set it to nil again, you should always run
 the `nnml-generate-nov-databases' command.  The function will go
 through all nnml directories and generate nov databases for them
-all.  This may very well take some time.
-
-This variable is a virtual server slot.  See the Gnus manual for details.")
+all.  This may very well take some time.")
 
 (defvoo nnml-marks-is-evil nil
   "If non-nil, Gnus will never generate and use marks file for mail spools.
@@ -80,26 +73,18 @@ separately from `.newsrc.eld'.  If you have, for some reason, set this
 to t, and want to set it to nil again, you should always remove the
 corresponding marks file (usually named `.marks' in the nnml group
 directory, but see `nnml-marks-file-name') for the group.  Then the
-marks file will be regenerated properly by Gnus.
-
-This variable is a virtual server slot.  See the Gnus manual for details.")
+marks file will be regenerated properly by Gnus.")
 
 (defvoo nnml-filenames-are-evil t
   "If non-nil, Gnus will not assume that the articles file name 
 is the same as the article number listed in the nov database.  This 
-variable should be set if any of the files are compressed.
-
-This variable is a virtual server slot.  See the Gnus manual for details.")
+variable should be set if any of the files are compressed.")
 
 (defvoo nnml-prepare-save-mail-hook nil
-  "Hook run narrowed to an article before saving.
-
-This variable is a virtual server slot.  See the Gnus manual for details.")
+  "Hook run narrowed to an article before saving.")
 
 (defvoo nnml-inhibit-expiry nil
-  "If non-nil, inhibit expiry.
-
-This variable is a virtual server slot.  See the Gnus manual for details.")
+  "If non-nil, inhibit expiry.")
 
 
 \f
@@ -330,7 +315,9 @@ This variable is a virtual server slot.  See the Gnus manual for details.")
                (let (nnml-current-directory
                      nnml-current-group
                      nnml-article-file-alist)
-                 (nnmail-expiry-target-group nnmail-expiry-target group))))
+                 (nnmail-expiry-target-group nnmail-expiry-target group)))
+             ;; Maybe directory is changed during nnmail-expiry-target-group.
+             (nnml-possibly-change-directory group server))
            (nnheader-message 5 "Deleting article %s in %s"
                              number group)
            (condition-case ()
@@ -974,8 +961,8 @@ Use the nov database for the current group if available."
                                (nnmail-group-pathname group nnml-directory))))
     (if (null (gnus-gethash file nnml-marks-modtime))
        t ;; never looked at marks file, assume it has changed
-      (not (eq (gnus-gethash file nnml-marks-modtime)
-              (nth 5 (file-attributes file)))))))
+      (not (equal (gnus-gethash file nnml-marks-modtime)
+                 (nth 5 (file-attributes file)))))))
 
 (defun nnml-save-marks (group server)
   (let ((file-name-coding-system nnmail-pathname-coding-system)
@@ -986,7 +973,7 @@ Use the nov database for the current group if available."
          (nnml-possibly-create-directory group)
          (with-temp-file file
            (erase-buffer)
-           (princ nnml-marks (current-buffer))
+           (gnus-prin1 nnml-marks)
            (insert "\n"))
          (gnus-sethash file
                        (nth 5 (file-attributes file))
@@ -1000,16 +987,17 @@ Use the nov database for the current group if available."
               nnml-marks-file-name 
               (nnmail-group-pathname group nnml-directory))))
     (if (file-exists-p file)
-       (setq nnml-marks (condition-case err
-                            (with-temp-buffer
-                              (gnus-sethash file
-                                            (nth 5 (file-attributes file))
-                                            nnml-marks-modtime)
-                              (nnheader-insert-file-contents file)
-                              (read (current-buffer)))
-                          (error (or (gnus-yes-or-no-p
-                                      (format "Error reading nnml marks file %s (%s).  Continuing will use marks from .newsrc.eld.  Continue? " file err))
-                                     (error "Cannot read nnml marks file %s (%s)" file err)))))
+       (condition-case err
+           (with-temp-buffer
+             (gnus-sethash file (nth 5 (file-attributes file))
+                           nnml-marks-modtime)
+             (nnheader-insert-file-contents file)
+             (setq nnml-marks (read (current-buffer)))
+             (dolist (el gnus-article-unpropagated-mark-lists)
+               (setq nnml-marks (gnus-remassoc el nnml-marks))))
+         (error (or (gnus-yes-or-no-p
+                     (format "Error reading nnml marks file %s (%s).  Continuing will use marks from .newsrc.eld.  Continue? " file err))
+                    (error "Cannot read nnml marks file %s (%s)" file err))))
       ;; User didn't have a .marks file.  Probably first time
       ;; user of the .marks stuff.  Bootstrap it from .newsrc.eld.
       (let ((info (gnus-get-info
@@ -1019,6 +1007,8 @@ Use the nov database for the current group if available."
        (nnheader-message 7 "Bootstrapping marks for %s..." group)
        (setq nnml-marks (gnus-info-marks info))
        (push (cons 'read (gnus-info-read info)) nnml-marks)
+       (dolist (el gnus-article-unpropagated-mark-lists)
+         (setq nnml-marks (gnus-remassoc el nnml-marks)))
        (nnml-save-marks group server)))))
 
 (provide 'nnml)