1 ;;; nnfolder.el --- mail folder access for Gnus
2 ;; Copyright (C) 1995,96 Free Software Foundation, Inc.
4 ;; Author: Scott Byer <byer@mv.us.adobe.com>
5 ;; Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
6 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
7 ;; Keywords: news, mail
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 ;; For an overview of what the interface functions do, please see the
30 ;; Various enhancements by byer@mv.us.adobe.com (Scott Byer).
37 (eval-when-compile (require 'cl))
39 (defvar nnfolder-directory (expand-file-name "~/Mail/")
40 "The name of the mail box file in the users home directory.")
42 (defvar nnfolder-active-file
43 (concat (file-name-as-directory nnfolder-directory) "active")
44 "The name of the active file.")
46 ;; I renamed this variable to something more in keeping with the general GNU
49 (defvar nnfolder-ignore-active-file nil
50 "If non-nil, causes nnfolder to do some extra work in order to determine the true active ranges of an mbox file.
51 Note that the active file is still saved, but it's values are not
52 used. This costs some extra time when scanning an mbox when opening
55 ;; Note that this variable may not be completely implemented yet. -SLB
57 (defvar nnfolder-always-close nil
58 "If non-nil, nnfolder attempts to only ever have one mbox open at a time.
59 This is a straight space/performance trade off, as the mboxes will have to
60 be scanned every time they are read in. If nil (default), nnfolder will
61 attempt to keep the buffers around (saving the nnfolder's buffer upon group
62 close, but not killing it), speeding some things up tremendously, especially
63 such things as moving mail. All buffers always get killed upon server close.")
65 (defvar nnfolder-newsgroups-file
66 (concat (file-name-as-directory nnfolder-directory) "newsgroups")
67 "Mail newsgroups description file.")
69 (defvar nnfolder-get-new-mail t
70 "If non-nil, nnfolder will check the incoming mail file and split the mail.")
72 (defvar nnfolder-prepare-save-mail-hook nil
73 "Hook run narrowed to an article before saving.")
75 (defvar nnfolder-inhibit-expiry nil
76 "If non-nil, inhibit expiry.")
80 (defconst nnfolder-version "nnfolder 1.0"
83 (defconst nnfolder-article-marker "X-Gnus-Article-Number: "
84 "String used to demarcate what the article number for a message is.")
86 (defvar nnfolder-current-group nil)
87 (defvar nnfolder-current-buffer nil)
88 (defvar nnfolder-status-string "")
89 (defvar nnfolder-group-alist nil)
90 (defvar nnfolder-buffer-alist nil)
91 (defvar nnfolder-active-timestamp nil)
95 (defvar nnfolder-current-server nil)
96 (defvar nnfolder-server-alist nil)
97 (defvar nnfolder-server-variables
99 (list 'nnfolder-directory nnfolder-directory)
100 (list 'nnfolder-active-file nnfolder-active-file)
101 (list 'nnfolder-newsgroups-file nnfolder-newsgroups-file)
102 (list 'nnfolder-get-new-mail nnfolder-get-new-mail)
103 (list 'nnfolder-inhibit-expiry nnfolder-inhibit-expiry)
104 '(nnfolder-current-group nil)
105 '(nnfolder-current-buffer nil)
106 '(nnfolder-status-string "")
107 '(nnfolder-group-alist nil)
108 '(nnfolder-buffer-alist nil)
109 '(nnfolder-active-timestamp nil)))
113 ;;; Interface functions
115 (defun nnfolder-retrieve-headers (sequence &optional newsgroup server fetch-old)
117 (set-buffer nntp-server-buffer)
119 (let ((delim-string (concat "^" rmail-unix-mail-delimiter))
120 article art-string start stop)
121 (nnfolder-possibly-change-group newsgroup)
122 (set-buffer nnfolder-current-buffer)
123 (goto-char (point-min))
124 (if (stringp (car sequence))
127 (setq article (car sequence))
128 (setq art-string (nnfolder-article-string article))
129 (set-buffer nnfolder-current-buffer)
130 (if (or (search-forward art-string nil t)
131 ;; Don't search the whole file twice! Also, articles
132 ;; probably have some locality by number, so searching
133 ;; backwards will be faster. Especially if we're at the
134 ;; beginning of the buffer :-). -SLB
135 (search-backward art-string nil t))
137 (setq start (or (re-search-backward delim-string nil t)
139 (search-forward "\n\n" nil t)
140 (setq stop (1- (point)))
141 (set-buffer nntp-server-buffer)
142 (insert (format "221 %d Article retrieved.\n" article))
143 (insert-buffer-substring nnfolder-current-buffer start stop)
144 (goto-char (point-max))
146 (setq sequence (cdr sequence)))
148 (set-buffer nntp-server-buffer)
149 (nnheader-fold-continuation-lines)
152 (defun nnfolder-open-server (server &optional defs)
153 (nnheader-init-server-buffer)
154 (if (equal server nnfolder-current-server)
156 (if nnfolder-current-server
157 (setq nnfolder-server-alist
158 (cons (list nnfolder-current-server
159 (nnheader-save-variables nnfolder-server-variables))
160 nnfolder-server-alist)))
161 (let ((state (assoc server nnfolder-server-alist)))
164 (nnheader-restore-variables (nth 1 state))
165 (setq nnfolder-server-alist (delq state nnfolder-server-alist)))
166 (nnheader-set-init-variables nnfolder-server-variables defs)))
167 (setq nnfolder-current-server server)))
169 (defun nnfolder-close-server (&optional server)
170 (setq nnfolder-current-server nil)
173 (defun nnfolder-server-opened (&optional server)
174 (and (equal server nnfolder-current-server)
176 (buffer-name nntp-server-buffer)))
178 (defun nnfolder-request-close ()
179 (let ((alist nnfolder-buffer-alist))
181 (nnfolder-close-group (car (car alist)) nil t)
182 (setq alist (cdr alist))))
183 (setq nnfolder-buffer-alist nil
184 nnfolder-group-alist nil))
186 (defun nnfolder-status-message (&optional server)
187 nnfolder-status-string)
189 (defun nnfolder-request-article (article &optional newsgroup server buffer)
190 (nnfolder-possibly-change-group newsgroup)
192 (set-buffer nnfolder-current-buffer)
193 (goto-char (point-min))
194 (if (search-forward (nnfolder-article-string article) nil t)
196 (re-search-backward (concat "^" rmail-unix-mail-delimiter) nil t)
199 (or (and (re-search-forward
200 (concat "^" rmail-unix-mail-delimiter) nil t)
202 (goto-char (point-max)))
204 (let ((nntp-server-buffer (or buffer nntp-server-buffer)))
205 (set-buffer nntp-server-buffer)
207 (insert-buffer-substring nnfolder-current-buffer start stop)
208 (goto-char (point-min))
209 (while (looking-at "From ")
211 (insert "X-From-Line: ")
213 (if (numberp article)
214 (cons nnfolder-current-group article)
215 (goto-char (point-min))
216 (search-forward (concat "\n" nnfolder-article-marker))
217 (cons nnfolder-current-group
220 (point) (progn (end-of-line) (point)))))))))))
222 (defun nnfolder-request-group (group &optional server dont-check)
224 (nnmail-activate 'nnfolder)
225 (when (assoc group nnfolder-group-alist)
226 (nnfolder-possibly-change-group group)
229 (nnheader-report 'nnfolder "Selected group %s" group)
232 (let* ((active (assoc group nnfolder-group-alist))
234 (range (car (cdr active)))
235 (minactive (car range))
236 (maxactive (cdr range)))
237 (set-buffer nntp-server-buffer)
241 (nnheader-report 'nnfolder "No such group: %s" group))
243 (nnheader-report 'nnfolder "Selected group %s" group)
244 (insert (format "211 %d %d %d %s\n"
245 (1+ (- maxactive minactive))
246 minactive maxactive group))
249 (defun nnfolder-request-scan (&optional group server)
253 (let ((bufs nnfolder-buffer-alist))
256 (if (not (buffer-name (nth 1 (car bufs))))
257 (setq nnfolder-buffer-alist
258 (delq (car bufs) nnfolder-buffer-alist))
259 (set-buffer (nth 1 (car bufs)))
260 (and (buffer-modified-p) (save-buffer)))
261 (setq bufs (cdr bufs))))))
265 ;; Don't close the buffer if we're not shutting down the server. This way,
266 ;; we can keep the buffer in the group buffer cache, and not have to grovel
267 ;; over the buffer again unless we add new mail to it or modify it in some
270 (defun nnfolder-close-group (group &optional server force)
271 ;; Make sure we _had_ the group open.
272 (if (or (assoc group nnfolder-buffer-alist)
273 (equal group nnfolder-current-group))
275 (nnfolder-possibly-change-group group)
277 (set-buffer nnfolder-current-buffer)
278 ;; If the buffer was modified, write the file out now.
279 (and (buffer-modified-p) (save-buffer))
281 nnfolder-always-close)
282 ;; If we're shutting the server down, we need to kill the
283 ;; buffer and remove it from the open buffer list. Or, of
284 ;; course, if we're trying to minimize our space impact.
286 (kill-buffer (current-buffer))
287 (setq nnfolder-buffer-alist (delq (assoc group
288 nnfolder-buffer-alist)
289 nnfolder-buffer-alist)))))))
290 (setq nnfolder-current-group nil
291 nnfolder-current-buffer nil)
294 (defun nnfolder-request-create-group (group &optional server)
295 (nnmail-activate 'nnfolder)
296 (or (assoc group nnfolder-group-alist)
298 (setq nnfolder-group-alist
299 (cons (list group (setq active (cons 1 0)))
300 nnfolder-group-alist))
301 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)))
304 (defun nnfolder-request-list (&optional server)
306 (nnmail-find-file nnfolder-active-file)
307 (setq nnfolder-group-alist (nnmail-get-active))))
309 (defun nnfolder-request-newgroups (date &optional server)
310 (nnfolder-request-list server))
312 (defun nnfolder-request-list-newsgroups (&optional server)
314 (nnmail-find-file nnfolder-newsgroups-file)))
316 (defun nnfolder-request-post (&optional server)
317 (mail-send-and-exit nil))
319 (defun nnfolder-request-expire-articles
320 (articles newsgroup &optional server force)
321 (nnfolder-possibly-change-group newsgroup)
324 (nnmail-activate 'nnfolder)
327 (set-buffer nnfolder-current-buffer)
328 (while (and articles is-old)
329 (goto-char (point-min))
330 (if (search-forward (nnfolder-article-string (car articles)) nil t)
332 (nnmail-expired-article-p
335 (point) (progn (end-of-line) (point)))
336 force nnfolder-inhibit-expiry))
338 (nnheader-message 5 "Deleting article %d..."
339 (car articles) newsgroup)
340 (nnfolder-delete-mail))
341 (setq rest (cons (car articles) rest))))
342 (setq articles (cdr articles)))
343 (and (buffer-modified-p) (save-buffer))
344 ;; Find the lowest active article in this group.
345 (let* ((active (car (cdr (assoc newsgroup nnfolder-group-alist))))
346 (marker (concat "\n" nnfolder-article-marker))
348 (activemin (cdr active)))
349 (goto-char (point-min))
350 (while (and (search-forward marker nil t)
351 (re-search-forward number nil t))
352 (setq activemin (min activemin
353 (string-to-number (buffer-substring
356 (setcar active activemin))
357 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
358 (nconc rest articles))))
360 (defun nnfolder-request-move-article
361 (article group server accept-form &optional last)
362 (nnfolder-possibly-change-group group)
363 (let ((buf (get-buffer-create " *nnfolder move*"))
366 (nnfolder-request-article article group server)
369 (buffer-disable-undo (current-buffer))
371 (insert-buffer-substring nntp-server-buffer)
372 (goto-char (point-min))
373 (while (re-search-forward
374 (concat "^" nnfolder-article-marker)
375 (save-excursion (search-forward "\n\n" nil t) (point)) t)
376 (delete-region (progn (beginning-of-line) (point))
377 (progn (forward-line 1) (point))))
378 (setq result (eval accept-form))
382 (nnfolder-possibly-change-group group)
383 (set-buffer nnfolder-current-buffer)
384 (goto-char (point-min))
385 (if (search-forward (nnfolder-article-string article) nil t)
386 (nnfolder-delete-mail))
392 (defun nnfolder-request-accept-article (group &optional last)
393 (and (stringp group) (nnfolder-possibly-change-group group))
394 (let ((buf (current-buffer))
396 (goto-char (point-min))
397 (when (looking-at "X-From-Line: ")
398 (replace-match "From "))
400 (nnfolder-request-list)
403 (goto-char (point-min))
404 (search-forward "\n\n" nil t)
406 (while (re-search-backward (concat "^" nnfolder-article-marker) nil t)
407 (delete-region (point) (progn (forward-line 1) (point))))
408 (setq result (car (nnfolder-save-mail (and (stringp group) group)))))
410 (set-buffer nnfolder-current-buffer)
411 (and last (buffer-modified-p) (save-buffer))))
412 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
415 (defun nnfolder-request-replace-article (article group buffer)
416 (nnfolder-possibly-change-group group)
418 (set-buffer nnfolder-current-buffer)
419 (goto-char (point-min))
420 (if (not (search-forward (nnfolder-article-string article) nil t))
422 (nnfolder-delete-mail t t)
423 (insert-buffer-substring buffer)
424 (and (buffer-modified-p) (save-buffer))
427 (defun nnfolder-request-delete-group (group &optional force server)
428 (nnfolder-close-group group server t)
429 ;; Delete all articles in GROUP.
431 () ; Don't delete the articles.
432 ;; Delete the file that holds the group.
434 (delete-file (concat (file-name-as-directory nnfolder-directory)
437 ;; Remove the group from all structures.
438 (setq nnfolder-group-alist
439 (delq (assoc group nnfolder-group-alist) nnfolder-group-alist)
440 nnfolder-current-group nil
441 nnfolder-current-buffer nil)
442 ;; Save the active file.
443 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
446 (defun nnfolder-request-rename-group (group new-name &optional server)
447 (nnfolder-possibly-change-group group)
449 (set-buffer nnfolder-current-buffer)
450 (and (file-writable-p buffer-file-name)
453 (rename-file buffer-file-name
454 (concat (file-name-as-directory nnfolder-directory)
458 ;; That went ok, so we change the internal structures.
459 (let ((entry (assoc group nnfolder-group-alist)))
460 (and entry (setcar entry new-name))
461 (setq nnfolder-current-buffer nil
462 nnfolder-current-group nil)
463 ;; Save the new group alist.
464 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
465 ;; We kill the buffer instead of renaming it and stuff.
466 (kill-buffer (current-buffer))
470 ;;; Internal functions.
472 (defun nnfolder-article-string (article)
473 (if (numberp article)
474 (concat "\n" nnfolder-article-marker (int-to-string article) " ")
475 (concat "\nMessage-ID: " article)))
477 (defun nnfolder-delete-mail (&optional force leave-delim)
478 ;; Beginning of the article.
483 (re-search-backward (concat "^" rmail-unix-mail-delimiter) nil t)
484 (if leave-delim (progn (forward-line 1) (point))
485 (match-beginning 0)))
488 (or (and (re-search-forward (concat "^" rmail-unix-mail-delimiter)
490 (if (and (not (bobp)) leave-delim)
491 (progn (forward-line -2) (point))
492 (match-beginning 0)))
494 (delete-region (point-min) (point-max)))))
496 (defun nnfolder-possibly-change-group (group)
497 (or (file-exists-p nnfolder-directory)
498 (make-directory (directory-file-name nnfolder-directory) t))
499 (nnfolder-possibly-activate-groups nil)
500 (or (assoc group nnfolder-group-alist)
501 (not (file-exists-p (concat (file-name-as-directory nnfolder-directory)
504 (setq nnfolder-group-alist
505 (cons (list group (cons 1 0)) nnfolder-group-alist))
506 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)))
508 (if (and (equal group nnfolder-current-group)
509 nnfolder-current-buffer
510 (buffer-name nnfolder-current-buffer))
512 (setq nnfolder-current-group group)
514 ;; If we have to change groups, see if we don't already have the mbox
515 ;; in memory. If we do, verify the modtime and destroy the mbox if
516 ;; needed so we can rescan it.
517 (if (setq inf (assoc group nnfolder-buffer-alist))
518 (setq nnfolder-current-buffer (nth 1 inf)))
520 ;; If the buffer is not live, make sure it isn't in the alist. If it
521 ;; is live, verify that nobody else has touched the file since last
523 (if (or (not (and nnfolder-current-buffer
524 (buffer-name nnfolder-current-buffer)))
525 (not (and (bufferp nnfolder-current-buffer)
526 (verify-visited-file-modtime
527 nnfolder-current-buffer))))
529 (if (and nnfolder-current-buffer
530 (buffer-name nnfolder-current-buffer)
531 (bufferp nnfolder-current-buffer))
532 (kill-buffer nnfolder-current-buffer))
533 (setq nnfolder-buffer-alist (delq inf nnfolder-buffer-alist))
539 (setq file (concat (file-name-as-directory nnfolder-directory)
541 (if (file-directory-p (file-truename file))
543 (if (not (file-exists-p file))
544 (write-region 1 1 file t 'nomesg))
545 (setq nnfolder-current-buffer
546 (set-buffer (nnfolder-read-folder file)))
547 (setq nnfolder-buffer-alist (cons (list group (current-buffer))
548 nnfolder-buffer-alist)))))))
549 (setq nnfolder-current-group group))
551 (defun nnfolder-save-mail (&optional group)
552 "Called narrowed to an article."
553 (let* ((nnmail-split-methods
554 (if group (list (list group "")) nnmail-split-methods))
556 (nreverse (nnmail-article-group 'nnfolder-active-number)))
557 (delim (concat "^" rmail-unix-mail-delimiter))
559 (goto-char (point-min))
560 ;; This might come from somewhere else.
561 (unless (looking-at delim)
562 (insert "From nobody " (current-time-string) "\n")
563 (goto-char (point-min)))
564 ;; Quote all "From " lines in the article.
566 (while (re-search-forward delim nil t)
569 (setq save-list group-art-list)
570 (nnmail-insert-lines)
571 (nnmail-insert-xref group-art-list)
572 (run-hooks 'nnfolder-prepare-save-mail-hook)
574 ;; Insert the mail into each of the destination groups.
575 (while group-art-list
576 (setq group-art (car group-art-list)
577 group-art-list (cdr group-art-list))
579 ;; Kill the previous newsgroup markers.
580 (goto-char (point-min))
581 (search-forward "\n\n" nil t)
583 (while (search-backward (concat "\n" nnfolder-article-marker) nil t)
584 (delete-region (1+ (point)) (progn (forward-line 2) (point))))
586 ;; Insert the new newsgroup marker.
587 (nnfolder-possibly-change-group (car group-art))
588 (nnfolder-insert-newsgroup-line group-art)
589 (let ((beg (point-min))
591 (obuf (current-buffer)))
592 (set-buffer nnfolder-current-buffer)
593 (goto-char (point-max))
594 (insert-buffer-substring obuf beg end)
597 ;; Did we save it anywhere?
600 (defun nnfolder-insert-newsgroup-line (group-art)
602 (goto-char (point-min))
603 (if (search-forward "\n\n" nil t)
606 (insert (format (concat nnfolder-article-marker "%d %s\n")
607 (cdr group-art) (current-time-string)))))))
609 (defun nnfolder-possibly-activate-groups (&optional group)
611 ;; If we're looking for the activation of a specific group, find out
612 ;; its real name and switch to it.
613 (if group (nnfolder-possibly-change-group group))
614 ;; If the group alist isn't active, activate it now.
615 (nnmail-activate 'nnfolder)))
617 (defun nnfolder-active-number (group)
619 ;; Find the next article number in GROUP.
621 (let ((active (car (cdr (assoc group nnfolder-group-alist)))))
623 (setcdr active (1+ (cdr active)))
624 ;; This group is new, so we create a new entry for it.
625 ;; This might be a bit naughty... creating groups on the drop of
626 ;; a hat, but I don't know...
627 (setq nnfolder-group-alist
628 (cons (list group (setq active (cons 1 1)))
629 nnfolder-group-alist)))
631 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
632 (nnfolder-possibly-activate-groups group))))
635 ;; This method has a problem if you've accidentally let the active list get
636 ;; out of sync with the files. This could happen, say, if you've
637 ;; accidentally gotten new mail with something other than Gnus (but why
638 ;; would _that_ ever happen? :-). In that case, we will be in the middle of
639 ;; processing the file, ready to add new X-Gnus article number markers, and
640 ;; we'll run across a message with no ID yet - the active list _may_not_ be
643 ;; To handle this, I'm modifying this routine to maintain the maximum ID seen
644 ;; so far, and when we hit a message with no ID, we will _manually_ scan the
645 ;; rest of the message looking for any more, possibly higher IDs. We'll
646 ;; assume the maximum that we find is the highest active. Note that this
647 ;; shouldn't cost us much extra time at all, but will be a lot less
648 ;; vulnerable to glitches between the mbox and the active file.
650 (defun nnfolder-read-folder (file)
652 (nnfolder-possibly-activate-groups nil)
653 ;; We should be paranoid here and make sure the group is in the alist,
654 ;; and add it if it isn't.
655 ;;(if (not (assoc nnfoler-current-group nnfolder-group-alist)
656 (set-buffer (setq nnfolder-current-buffer
657 (nnheader-find-file-noselect file nil 'raw)))
658 (buffer-disable-undo (current-buffer))
659 (let ((delim (concat "^" rmail-unix-mail-delimiter))
660 (marker (concat "\n" nnfolder-article-marker))
662 (active (car (cdr (assoc nnfolder-current-group
663 nnfolder-group-alist))))
664 activenumber activemin start end)
665 (goto-char (point-min))
667 ;; Anytime the active number is 1 or 0, it is suspect. In that case,
668 ;; search the file manually to find the active number. Or, of course,
669 ;; if we're being paranoid. (This would also be the place to build
670 ;; other lists from the header markers, such as expunge lists, etc., if
671 ;; we ever desired to abandon the active file entirely for mboxes.)
672 (setq activenumber (cdr active))
673 (if (or nnfolder-ignore-active-file
676 (setq activemin (max (1- (lsh 1 23))
679 (while (and (search-forward marker nil t)
680 (re-search-forward number nil t))
681 (let ((newnum (string-to-number (buffer-substring
684 (setq activenumber (max activenumber newnum))
685 (setq activemin (min activemin newnum))))
686 (setcar active (max 1 (min activemin activenumber)))
687 (setcdr active (max activenumber (cdr active)))
688 (goto-char (point-min))))
690 ;; Keep track of the active number on our own, and insert it back into
691 ;; the active list when we're done. Also, prime the pump to cut down on
692 ;; the number of searches we do.
693 (setq end (point-marker))
694 (set-marker end (or (and (re-search-forward delim nil t)
697 (while (not (= end (point-max)))
698 (setq start (marker-position end))
700 ;; There may be more than one "From " line, so we skip past
702 (while (looking-at delim)
704 (set-marker end (or (and (re-search-forward delim nil t)
708 (if (not (search-forward marker end t))
710 (narrow-to-region start end)
711 (nnmail-insert-lines)
712 (nnfolder-insert-newsgroup-line
713 (cons nil (nnfolder-active-number nnfolder-current-group)))
716 ;; Make absolutely sure that the active list reflects reality!
717 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
721 (defun nnfolder-generate-active-file ()
722 "Look for mbox folders in the nnfolder directory and make them into groups."
724 (nnmail-activate 'nnfolder)
725 (let ((files (directory-files nnfolder-directory))
727 (while (setq file (pop files))
728 (when (nnheader-mail-file-mbox-p file)
729 (nnheader-message 5 "Adding group %s..." file)
730 (push (list file (cons 1 0)) nnfolder-group-alist)
731 (nnfolder-read-folder file)
732 (nnfolder-close-group file))
737 ;;; nnfolder.el ends here