;;; nnfolder.el --- mail folder access for Gnus
-;; Copyright (C) 1995,96,97,98,99 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
+;; Free Software Foundation, Inc.
;; Author: Scott Byer <byer@mv.us.adobe.com>
;; Lars Magne Ingebrigtsen <larsi@gnus.org>
"The name of the nnfolder directory.")
(defvoo nnfolder-active-file
- (nnheader-concat nnfolder-directory "active")
+ (nnheader-concat nnfolder-directory "active")
"The name of the active file.")
;; I renamed this variable to something more in keeping with the general GNU
;; style. -SLB
(defvoo nnfolder-ignore-active-file nil
- "If non-nil, causes nnfolder to do some extra work in order to determine
-the true active ranges of an mbox file. Note that the active file is still
-saved, but it's values are not used. This costs some extra time when
-scanning an mbox when opening it.")
+ "If non-nil, the active file is ignores.
+This causes nnfolder to do some extra work in order to determine the
+true active ranges of an mbox file. Note that the active file is
+still saved, but it's values are not used. This costs some extra time
+when scanning an mbox when opening it.")
(defvoo nnfolder-distrust-mbox nil
- "If non-nil, causes nnfolder to not trust the user with respect to
-inserting unaccounted for mail in the middle of an mbox file. This can greatly
-slow down scans, which now must scan the entire file for unmarked messages.
-When nil, scans occur forward from the last marked message, a huge
-time saver for large mailboxes.")
+ "If non-nil, the folder will be distrusted.
+This means that nnfolder will not trust the user with respect to
+inserting unaccounted for mail in the middle of an mbox file. This
+can greatly slow down scans, which now must scan the entire file for
+unmarked messages. When nil, scans occur forward from the last marked
+message, a huge time saver for large mailboxes.")
(defvoo nnfolder-newsgroups-file
- (concat (file-name-as-directory nnfolder-directory) "newsgroups")
+ (concat (file-name-as-directory nnfolder-directory) "newsgroups")
"Mail newsgroups description file.")
(defvoo nnfolder-get-new-mail t
(set-buffer nnfolder-current-buffer)
(when (nnfolder-goto-article article)
(setq start (point))
- (search-forward "\n\n" nil t)
- (setq stop (1- (point)))
+ (setq stop (if (search-forward "\n\n" nil t)
+ (1- (point))
+ (point-max)))
(set-buffer nntp-server-buffer)
(insert (format "221 %d Article retrieved.\n" article))
(insert-buffer-substring nnfolder-current-buffer start stop)
(if (numberp article)
(cons nnfolder-current-group article)
(goto-char (point-min))
- (search-forward (concat "\n" nnfolder-article-marker))
(cons nnfolder-current-group
- (string-to-int
- (buffer-substring
- (point) (progn (end-of-line) (point)))))))))))
+ (if (search-forward (concat "\n" nnfolder-article-marker)
+ nil t)
+ (string-to-int
+ (buffer-substring
+ (point) (progn (end-of-line) (point))))
+ -1))))))))
(deffoo nnfolder-request-group (group &optional server dont-check)
(nnfolder-possibly-change-group group server t)
numbers))))
(deffoo nnfolder-request-expire-articles
- (articles newsgroup &optional server force)
+ (articles newsgroup &optional server force)
(nnfolder-possibly-change-group newsgroup server)
(let* ((is-old t)
;; The articles we have deleted so far.
(deleted-articles nil)
- ;; The articles that really exist and will be expired if they are old enough.
- (maybe-expirable (gnus-intersection articles (nnfolder-existing-articles))))
+ ;; The articles that really exist and will
+ ;; be expired if they are old enough.
+ (maybe-expirable
+ (gnus-intersection articles (nnfolder-existing-articles))))
(nnmail-activate 'nnfolder)
(save-excursion
nil t))
(forward-sexp)
(when (setq is-old
- (nnmail-expired-article-p
- newsgroup
- (buffer-substring
- (point) (progn (end-of-line) (point)))
- force nnfolder-inhibit-expiry))
- (nnheader-message 5 "Deleting article %d..."
+ (nnmail-expired-article-p
+ newsgroup
+ (buffer-substring
+ (point) (progn (end-of-line) (point)))
+ force nnfolder-inhibit-expiry))
+ (nnheader-message 5 "Deleting article %d..."
(car maybe-expirable) newsgroup)
(nnfolder-delete-mail)
;; Must remember which articles were actually deleted
(goto-char (point-min))
(while (re-search-forward
(concat "^" nnfolder-article-marker)
- (save-excursion (search-forward "\n\n" nil t) (point)) t)
+ (save-excursion (and (search-forward "\n\n" nil t) (point)))
+ t)
(delete-region (progn (beginning-of-line) (point))
(progn (forward-line 1) (point))))
(setq result (eval accept-form))
(save-excursion
(set-buffer buf)
(goto-char (point-min))
- (search-forward "\n\n" nil t)
- (forward-line -1)
+ (if (search-forward "\n\n" nil t)
+ (forward-line -1)
+ (goto-char (point-max)))
(while (re-search-backward (concat "^" nnfolder-article-marker) nil t)
(delete-region (point) (progn (forward-line 1) (point))))
(when nnmail-cache-accepted-message-ids
(while (setq group-art (pop group-art-list))
;; Kill any previous newsgroup markers.
(goto-char (point-min))
- (search-forward "\n\n" nil t)
- (forward-line -1)
+ (if (search-forward "\n\n" nil t)
+ (forward-line -1)
+ (goto-char (point-max)))
(while (search-backward (concat "\n" nnfolder-article-marker) nil t)
(delete-region (1+ (point)) (progn (forward-line 2) (point))))
(defun nnfolder-insert-newsgroup-line (group-art)
(save-excursion
(goto-char (point-min))
- (when (search-forward "\n\n" nil t)
- (forward-char -1)
- (insert (format (concat nnfolder-article-marker "%d %s\n")
- (cdr group-art) (current-time-string))))))
+ (unless (search-forward "\n\n" nil t)
+ (goto-char (point-max))
+ (insert "\n"))
+ (forward-char -1)
+ (insert (format (concat nnfolder-article-marker "%d %s\n")
+ (cdr group-art) (current-time-string)))))
(defun nnfolder-active-number (group)
;; Find the next article number in GROUP.
buffer
(push (list group buffer) nnfolder-buffer-alist)
(set-buffer-modified-p t)
- (save-buffer))
+ (nnfolder-save-buffer))
;; Parse the damn thing.
(save-excursion
(goto-char (point-min))