This variable is a virtual server slot. See the Gnus manual for details.")
+(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.")
+
(defvoo nnml-prepare-save-mail-hook nil
"Hook run narrowed to an article before saving.
(defvoo nnml-marks nil)
-\f
+(defvar nnml-marks-modtime (gnus-make-hashtable))
+\f
;;; Interface functions.
(nnoo-define-basics nnml)
(when (and (setq group-num (nnml-find-group-number id))
(cdr
(assq (cdr group-num)
- (nnml-article-to-file-alist
+ (nnheader-article-to-file-alist
(setq gpath
(nnmail-group-pathname
(car group-num)
;; We move the articles file by file instead of renaming
;; the directory -- there may be subgroups in this group.
;; One might be more clever, I guess.
- (let ((files (nnml-article-to-file-alist old-dir)))
+ (let ((files (nnheader-article-to-file-alist old-dir)))
(while files
(rename-file
(concat old-dir (cdar files))
(unless nnml-article-file-alist
(setq nnml-article-file-alist
(sort
- (nnml-article-to-file-alist nnml-current-directory)
+ (nnml-current-group-article-to-file-alist)
'car-less-than-car)))
(setq active
(if nnml-article-file-alist
(when (or (not nnml-article-file-alist)
force)
(setq nnml-article-file-alist
- (nnml-article-to-file-alist nnml-current-directory))))
+ (nnml-current-group-article-to-file-alist))))
(defun nnml-directory-articles (dir)
"Return a list of all article files in a directory.
(forward-line 1))
list))))
-(defun nnml-article-to-file-alist (dir)
- "Return an alist of article/file pairs in DIR.
-Use the nov database for that directory if available."
- (if (or gnus-nov-is-evil nnml-nov-is-evil
+(defun nnml-current-group-article-to-file-alist ()
+ "Return an alist of article/file pairs in the current group.
+Use the nov database for the current group if available."
+ (if (or gnus-nov-is-evil
+ nnml-nov-is-evil
+ nnml-filenames-are-evil
(not (file-exists-p
(expand-file-name nnml-nov-file-name
nnml-current-directory))))
(deffoo nnml-request-update-info (group info &optional server)
(nnml-possibly-change-directory group server)
- (unless nnml-marks-is-evil
+ (when (and (not nnml-marks-is-evil) (nnml-marks-changed-p group))
(nnheader-message 8 "Updating marks for %s..." group)
(nnml-open-marks group server)
;; Update info using `nnml-marks'.
(nnheader-message 8 "Updating marks for %s...done" group))
info)
+(defun nnml-marks-changed-p (group)
+ (let ((file (expand-file-name nnml-marks-file-name
+ (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)))))))
+
(defun nnml-save-marks (group server)
(let ((file-name-coding-system nnmail-pathname-coding-system)
(file (expand-file-name nnml-marks-file-name
(with-temp-file file
(erase-buffer)
(princ nnml-marks (current-buffer))
- (insert "\n")))
+ (insert "\n"))
+ (gnus-sethash file
+ (nth 5 (file-attributes file))
+ nnml-marks-modtime))
(error (or (gnus-yes-or-no-p
(format "Could not write to %s (%s). Continue? " file err))
(error "Cannot write to %s (%s)" err))))))
(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