2001-09-08 Simon Josefsson <jas@extundo.com>
+ * nnml.el (nnml-marks-modtime): New variable.
+ (nnml-marks-changed-p): New function.
+ (nnml-save-marks, nnml-open-marks): Save modtime.
+ (nnml-request-update-info): Don't update if marks didn't change.
+
* gnus-agent.el (gnus-agent-any-covered-gcc)
(gnus-agent-add-server, gnus-agent-remove-server): Use
gnus-agent-method-p.
(defvoo nnml-marks nil)
-\f
+(defvar nnml-marks-modtime (makehash))
+\f
;;; Interface functions.
(nnoo-define-basics nnml)
(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 (gethash file nnml-marks-modtime))
+ t ;; never looked at marks file, assume it has changed
+ (not (eq (gethash fil 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"))
+ (puthash 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
+ (puthash file
+ (nth 5 (file-attributes file))
+ nnml-marks-modtime)
(nnheader-insert-file-contents file)
(read (current-buffer)))
(error (or (gnus-yes-or-no-p