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>
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 the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
28 ;; For an overview of what the interface functions do, please see the
31 ;; Various enhancements by byer@mv.us.adobe.com (Scott Byer).
39 (eval-when-compile (require 'cl))
41 (nnoo-declare nnfolder)
43 (defvoo nnfolder-directory (expand-file-name message-directory)
44 "The name of the nnfolder directory.")
46 (defvoo nnfolder-active-file
47 (nnheader-concat nnfolder-directory "active")
48 "The name of the active file.")
50 ;; I renamed this variable to something more in keeping with the general GNU
53 (defvoo nnfolder-ignore-active-file nil
54 "If non-nil, causes nnfolder to do some extra work in order to determine the true active ranges of an mbox file.
55 Note that the active file is still saved, but it's values are not
56 used. This costs some extra time when scanning an mbox when opening
59 (defvoo nnfolder-newsgroups-file
60 (concat (file-name-as-directory nnfolder-directory) "newsgroups")
61 "Mail newsgroups description file.")
63 (defvoo nnfolder-get-new-mail t
64 "If non-nil, nnfolder will check the incoming mail file and split the mail.")
66 (defvoo nnfolder-prepare-save-mail-hook nil
67 "Hook run narrowed to an article before saving.")
69 (defvoo nnfolder-save-buffer-hook nil
70 "Hook run before saving the nnfolder mbox buffer.")
72 (defvoo nnfolder-inhibit-expiry nil
73 "If non-nil, inhibit expiry.")
77 (defconst nnfolder-version "nnfolder 1.0"
80 (defconst nnfolder-article-marker "X-Gnus-Article-Number: "
81 "String used to demarcate what the article number for a message is.")
83 (defvoo nnfolder-current-group nil)
84 (defvoo nnfolder-current-buffer nil)
85 (defvoo nnfolder-status-string "")
86 (defvoo nnfolder-group-alist nil)
87 (defvoo nnfolder-buffer-alist nil)
88 (defvoo nnfolder-active-timestamp nil)
92 ;;; Interface functions
94 (nnoo-define-basics nnfolder)
96 (deffoo nnfolder-retrieve-headers (articles &optional group server fetch-old)
98 (set-buffer nntp-server-buffer)
100 (let ((delim-string (concat "^" message-unix-mail-delimiter))
101 article art-string start stop)
102 (nnfolder-possibly-change-group group server)
103 (when nnfolder-current-buffer
104 (set-buffer nnfolder-current-buffer)
105 (goto-char (point-min))
106 (if (stringp (car articles))
109 (setq article (car articles))
110 (setq art-string (nnfolder-article-string article))
111 (set-buffer nnfolder-current-buffer)
112 (if (or (search-forward art-string nil t)
113 ;; Don't search the whole file twice! Also, articles
114 ;; probably have some locality by number, so searching
115 ;; backwards will be faster. Especially if we're at the
116 ;; beginning of the buffer :-). -SLB
117 (search-backward art-string nil t))
119 (setq start (or (re-search-backward delim-string nil t)
121 (search-forward "\n\n" nil t)
122 (setq stop (1- (point)))
123 (set-buffer nntp-server-buffer)
124 (insert (format "221 %d Article retrieved.\n" article))
125 (insert-buffer-substring nnfolder-current-buffer start stop)
126 (goto-char (point-max))
128 (setq articles (cdr articles)))
130 (set-buffer nntp-server-buffer)
131 (nnheader-fold-continuation-lines)
134 (deffoo nnfolder-open-server (server &optional defs)
135 (nnoo-change-server 'nnfolder server defs)
136 (when (not (file-exists-p nnfolder-directory))
138 (make-directory nnfolder-directory t)
141 ((not (file-exists-p nnfolder-directory))
142 (nnfolder-close-server)
143 (nnheader-report 'nnfolder "Couldn't create directory: %s"
145 ((not (file-directory-p (file-truename nnfolder-directory)))
146 (nnfolder-close-server)
147 (nnheader-report 'nnfolder "Not a directory: %s" nnfolder-directory))
149 (nnheader-report 'nnfolder "Opened server %s using directory %s"
150 server nnfolder-directory)
153 (deffoo nnfolder-request-close ()
154 (let ((alist nnfolder-buffer-alist))
156 (nnfolder-close-group (caar alist) nil t)
157 (setq alist (cdr alist))))
158 (nnoo-close-server 'nnfolder)
159 (setq nnfolder-buffer-alist nil
160 nnfolder-group-alist nil))
162 (deffoo nnfolder-request-article (article &optional group server buffer)
163 (nnfolder-possibly-change-group group server)
165 (set-buffer nnfolder-current-buffer)
166 (goto-char (point-min))
167 (if (search-forward (nnfolder-article-string article) nil t)
169 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
172 (or (and (re-search-forward
173 (concat "^" message-unix-mail-delimiter) nil t)
175 (goto-char (point-max)))
177 (let ((nntp-server-buffer (or buffer nntp-server-buffer)))
178 (set-buffer nntp-server-buffer)
180 (insert-buffer-substring nnfolder-current-buffer start stop)
181 (goto-char (point-min))
182 (while (looking-at "From ")
184 (insert "X-From-Line: ")
186 (if (numberp article)
187 (cons nnfolder-current-group article)
188 (goto-char (point-min))
189 (search-forward (concat "\n" nnfolder-article-marker))
190 (cons nnfolder-current-group
193 (point) (progn (end-of-line) (point)))))))))))
195 (deffoo nnfolder-request-group (group &optional server dont-check)
197 (nnmail-activate 'nnfolder)
198 (if (not (assoc group nnfolder-group-alist))
199 (nnheader-report 'nnfolder "No such group: %s" group)
200 (nnfolder-possibly-change-group group server)
203 (nnheader-report 'nnfolder "Selected group %s" group)
205 (let* ((active (assoc group nnfolder-group-alist))
207 (range (cadr active)))
210 (nnheader-report 'nnfolder "No such group: %s" group))
211 ((null nnfolder-current-group)
212 (nnheader-report 'nnfolder "Empty group: %s" group))
214 (nnheader-report 'nnfolder "Selected group %s" group)
215 (nnheader-insert "211 %d %d %d %s\n"
216 (1+ (- (cdr range) (car range)))
217 (car range) (cdr range) group))))))))
219 (deffoo nnfolder-request-scan (&optional group server)
220 (nnfolder-possibly-change-group group server)
224 (let ((bufs nnfolder-buffer-alist))
227 (if (not (buffer-name (nth 1 (car bufs))))
228 (setq nnfolder-buffer-alist
229 (delq (car bufs) nnfolder-buffer-alist))
230 (set-buffer (nth 1 (car bufs)))
231 (nnfolder-save-buffer)
232 (kill-buffer (current-buffer)))
233 (setq bufs (cdr bufs))))))
237 ;; Don't close the buffer if we're not shutting down the server. This way,
238 ;; we can keep the buffer in the group buffer cache, and not have to grovel
239 ;; over the buffer again unless we add new mail to it or modify it in some
242 (deffoo nnfolder-close-group (group &optional server force)
243 ;; Make sure we _had_ the group open.
244 (when (or (assoc group nnfolder-buffer-alist)
245 (equal group nnfolder-current-group))
246 (let ((inf (assoc group nnfolder-buffer-alist)))
248 (when nnfolder-current-group
249 (push (list nnfolder-current-group nnfolder-current-buffer)
250 nnfolder-buffer-alist))
251 (setq nnfolder-buffer-alist
252 (delq inf nnfolder-buffer-alist))
253 (setq nnfolder-current-buffer (cadr inf)
254 nnfolder-current-group (car inf))))
255 (when (and nnfolder-current-buffer
256 (buffer-name nnfolder-current-buffer))
258 (set-buffer nnfolder-current-buffer)
259 ;; If the buffer was modified, write the file out now.
260 (nnfolder-save-buffer)
261 ;; If we're shutting the server down, we need to kill the
262 ;; buffer and remove it from the open buffer list. Or, of
263 ;; course, if we're trying to minimize our space impact.
264 (kill-buffer (current-buffer))
265 (setq nnfolder-buffer-alist (delq (assoc group nnfolder-buffer-alist)
266 nnfolder-buffer-alist)))))
267 (setq nnfolder-current-group nil
268 nnfolder-current-buffer nil)
271 (deffoo nnfolder-request-create-group (group &optional server)
272 (nnfolder-possibly-change-group nil server)
273 (nnmail-activate 'nnfolder)
275 (unless (assoc group nnfolder-group-alist)
276 (push (list group (cons 1 0)) nnfolder-group-alist)
277 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)))
280 (deffoo nnfolder-request-list (&optional server)
281 (nnfolder-possibly-change-group nil server)
283 (nnmail-find-file nnfolder-active-file)
284 (setq nnfolder-group-alist (nnmail-get-active))))
286 (deffoo nnfolder-request-newgroups (date &optional server)
287 (nnfolder-possibly-change-group nil server)
288 (nnfolder-request-list server))
290 (deffoo nnfolder-request-list-newsgroups (&optional server)
291 (nnfolder-possibly-change-group nil server)
293 (nnmail-find-file nnfolder-newsgroups-file)))
295 (deffoo nnfolder-request-expire-articles
296 (articles newsgroup &optional server force)
297 (nnfolder-possibly-change-group newsgroup server)
300 (nnmail-activate 'nnfolder)
303 (set-buffer nnfolder-current-buffer)
304 (while (and articles is-old)
305 (goto-char (point-min))
306 (if (search-forward (nnfolder-article-string (car articles)) nil t)
308 (nnmail-expired-article-p
311 (point) (progn (end-of-line) (point)))
312 force nnfolder-inhibit-expiry))
314 (nnheader-message 5 "Deleting article %d..."
315 (car articles) newsgroup)
316 (nnfolder-delete-mail))
317 (setq rest (cons (car articles) rest))))
318 (setq articles (cdr articles)))
319 (nnfolder-save-buffer)
320 ;; Find the lowest active article in this group.
321 (let* ((active (cadr (assoc newsgroup nnfolder-group-alist)))
322 (marker (concat "\n" nnfolder-article-marker))
324 (activemin (cdr active)))
325 (goto-char (point-min))
326 (while (and (search-forward marker nil t)
327 (re-search-forward number nil t))
328 (setq activemin (min activemin
329 (string-to-number (buffer-substring
332 (setcar active activemin))
333 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
334 (nconc rest articles))))
336 (deffoo nnfolder-request-move-article
337 (article group server accept-form &optional last)
338 (nnfolder-possibly-change-group group server)
339 (let ((buf (get-buffer-create " *nnfolder move*"))
342 (nnfolder-request-article article group server)
345 (buffer-disable-undo (current-buffer))
347 (insert-buffer-substring nntp-server-buffer)
348 (goto-char (point-min))
349 (while (re-search-forward
350 (concat "^" nnfolder-article-marker)
351 (save-excursion (search-forward "\n\n" nil t) (point)) t)
352 (delete-region (progn (beginning-of-line) (point))
353 (progn (forward-line 1) (point))))
354 (setq result (eval accept-form))
358 (nnfolder-possibly-change-group group server)
359 (set-buffer nnfolder-current-buffer)
360 (goto-char (point-min))
361 (if (search-forward (nnfolder-article-string article) nil t)
362 (nnfolder-delete-mail))
363 (and last (nnfolder-save-buffer))))
366 (deffoo nnfolder-request-accept-article (group &optional server last)
367 (nnfolder-possibly-change-group group server)
368 (and (stringp group) (nnfolder-possibly-change-group group))
369 (let ((buf (current-buffer))
371 (goto-char (point-min))
372 (when (looking-at "X-From-Line: ")
373 (replace-match "From "))
375 (nnfolder-request-list)
378 (goto-char (point-min))
379 (search-forward "\n\n" nil t)
381 (while (re-search-backward (concat "^" nnfolder-article-marker) nil t)
382 (delete-region (point) (progn (forward-line 1) (point))))
383 (setq result (car (nnfolder-save-mail (and (stringp group) group)))))
385 (set-buffer nnfolder-current-buffer)
386 (and last (nnfolder-save-buffer))))
387 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
389 (nnheader-report 'nnfolder "Couldn't store article"))
392 (deffoo nnfolder-request-replace-article (article group buffer)
393 (nnfolder-possibly-change-group group)
395 (set-buffer nnfolder-current-buffer)
396 (goto-char (point-min))
397 (if (not (search-forward (nnfolder-article-string article) nil t))
399 (nnfolder-delete-mail t t)
400 (insert-buffer-substring buffer)
401 (nnfolder-save-buffer)
404 (deffoo nnfolder-request-delete-group (group &optional force server)
405 (nnfolder-close-group group server t)
406 ;; Delete all articles in GROUP.
408 () ; Don't delete the articles.
409 ;; Delete the file that holds the group.
411 (delete-file (nnfolder-group-pathname group))
413 ;; Remove the group from all structures.
414 (setq nnfolder-group-alist
415 (delq (assoc group nnfolder-group-alist) nnfolder-group-alist)
416 nnfolder-current-group nil
417 nnfolder-current-buffer nil)
418 ;; Save the active file.
419 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
422 (deffoo nnfolder-request-rename-group (group new-name &optional server)
423 (nnfolder-possibly-change-group group server)
425 (set-buffer nnfolder-current-buffer)
426 (and (file-writable-p buffer-file-name)
431 (nnfolder-group-pathname new-name))
434 ;; That went ok, so we change the internal structures.
435 (let ((entry (assoc group nnfolder-group-alist)))
436 (and entry (setcar entry new-name))
437 (setq nnfolder-current-buffer nil
438 nnfolder-current-group nil)
439 ;; Save the new group alist.
440 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
441 ;; We kill the buffer instead of renaming it and stuff.
442 (kill-buffer (current-buffer))
446 ;;; Internal functions.
448 (defun nnfolder-article-string (article)
449 (if (numberp article)
450 (concat "\n" nnfolder-article-marker (int-to-string article) " ")
451 (concat "\nMessage-ID: " article)))
453 (defun nnfolder-delete-mail (&optional force leave-delim)
454 "Delete the message that point is in."
458 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
459 (if leave-delim (progn (forward-line 1) (point))
460 (match-beginning 0)))
463 (if (re-search-forward (concat "^" message-unix-mail-delimiter) nil t)
464 (if (and (not (bobp)) leave-delim)
465 (progn (forward-line -2) (point))
469 (defun nnfolder-possibly-change-group (group &optional server)
471 (not (nnfolder-server-opened server)))
472 (nnfolder-open-server server))
474 (unless (file-exists-p nnfolder-directory)
475 (make-directory (directory-file-name nnfolder-directory) t))
476 (nnfolder-possibly-activate-groups nil)
477 (or (assoc group nnfolder-group-alist)
479 (nnfolder-group-pathname group)))
481 (setq nnfolder-group-alist
482 (cons (list group (cons 1 0)) nnfolder-group-alist))
483 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)))
485 (if (and (equal group nnfolder-current-group)
486 nnfolder-current-buffer
487 (buffer-name nnfolder-current-buffer))
489 (setq nnfolder-current-group group)
491 ;; If we have to change groups, see if we don't already have the mbox
492 ;; in memory. If we do, verify the modtime and destroy the mbox if
493 ;; needed so we can rescan it.
494 (if (setq inf (assoc group nnfolder-buffer-alist))
495 (setq nnfolder-current-buffer (nth 1 inf)))
497 ;; If the buffer is not live, make sure it isn't in the alist. If it
498 ;; is live, verify that nobody else has touched the file since last
500 (if (or (not (and nnfolder-current-buffer
501 (buffer-name nnfolder-current-buffer)))
502 (not (and (bufferp nnfolder-current-buffer)
503 (verify-visited-file-modtime
504 nnfolder-current-buffer))))
506 (if (and nnfolder-current-buffer
507 (buffer-name nnfolder-current-buffer)
508 (bufferp nnfolder-current-buffer))
509 (kill-buffer nnfolder-current-buffer))
510 (setq nnfolder-buffer-alist (delq inf nnfolder-buffer-alist))
516 (setq file (nnfolder-group-pathname group))
517 (if (file-directory-p (file-truename file))
519 (unless (file-exists-p file)
520 (unless (file-exists-p (file-name-directory file))
521 (make-directory (file-name-directory file) t))
522 (write-region 1 1 file t 'nomesg))
523 (setq nnfolder-current-buffer
524 (set-buffer (nnfolder-read-folder file)))
525 (setq nnfolder-buffer-alist (cons (list group (current-buffer))
526 nnfolder-buffer-alist)))))))
527 (setq nnfolder-current-group group)))
529 (defun nnfolder-save-mail (&optional group)
530 "Called narrowed to an article."
531 (let* ((nnmail-split-methods
532 (if group (list (list group "")) nnmail-split-methods))
534 (nreverse (nnmail-article-group 'nnfolder-active-number)))
535 (delim (concat "^" message-unix-mail-delimiter))
537 (goto-char (point-min))
538 ;; This might come from somewhere else.
539 (unless (looking-at delim)
540 (insert "From nobody " (current-time-string) "\n")
541 (goto-char (point-min)))
542 ;; Quote all "From " lines in the article.
544 (while (re-search-forward delim nil t)
547 (setq save-list group-art-list)
548 (nnmail-insert-lines)
549 (nnmail-insert-xref group-art-list)
550 (run-hooks 'nnmail-prepare-save-mail-hook)
551 (run-hooks 'nnfolder-prepare-save-mail-hook)
553 ;; Insert the mail into each of the destination groups.
554 (while group-art-list
555 (setq group-art (car group-art-list)
556 group-art-list (cdr group-art-list))
558 ;; Kill the previous newsgroup markers.
559 (goto-char (point-min))
560 (search-forward "\n\n" nil t)
562 (while (search-backward (concat "\n" nnfolder-article-marker) nil t)
563 (delete-region (1+ (point)) (progn (forward-line 2) (point))))
565 (nnfolder-possibly-change-group (car group-art))
566 ;; Insert the new newsgroup marker.
567 (nnfolder-insert-newsgroup-line group-art)
568 (unless nnfolder-current-buffer
569 (nnfolder-request-create-group (car group-art))
570 (nnfolder-possibly-change-group (car group-art)))
571 (let ((beg (point-min))
573 (obuf (current-buffer)))
574 (set-buffer nnfolder-current-buffer)
575 (goto-char (point-max))
579 (insert-buffer-substring obuf beg end)
582 ;; Did we save it anywhere?
585 (defun nnfolder-insert-newsgroup-line (group-art)
587 (goto-char (point-min))
588 (if (search-forward "\n\n" nil t)
591 (insert (format (concat nnfolder-article-marker "%d %s\n")
592 (cdr group-art) (current-time-string)))))))
594 (defun nnfolder-possibly-activate-groups (&optional group)
596 ;; If we're looking for the activation of a specific group, find out
597 ;; its real name and switch to it.
598 (if group (nnfolder-possibly-change-group group))
599 ;; If the group alist isn't active, activate it now.
600 (nnmail-activate 'nnfolder)))
602 (defun nnfolder-active-number (group)
605 ;; Find the next article number in GROUP.
607 (let ((active (cadr (assoc group nnfolder-group-alist))))
609 (setcdr active (1+ (cdr active)))
610 ;; This group is new, so we create a new entry for it.
611 ;; This might be a bit naughty... creating groups on the drop of
612 ;; a hat, but I don't know...
613 (setq nnfolder-group-alist
614 (cons (list group (setq active (cons 1 1)))
615 nnfolder-group-alist)))
617 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
618 (nnfolder-possibly-activate-groups group)))))
621 ;; This method has a problem if you've accidentally let the active list get
622 ;; out of sync with the files. This could happen, say, if you've
623 ;; accidentally gotten new mail with something other than Gnus (but why
624 ;; would _that_ ever happen? :-). In that case, we will be in the middle of
625 ;; processing the file, ready to add new X-Gnus article number markers, and
626 ;; we'll run across a message with no ID yet - the active list _may_not_ be
629 ;; To handle this, I'm modifying this routine to maintain the maximum ID seen
630 ;; so far, and when we hit a message with no ID, we will _manually_ scan the
631 ;; rest of the message looking for any more, possibly higher IDs. We'll
632 ;; assume the maximum that we find is the highest active. Note that this
633 ;; shouldn't cost us much extra time at all, but will be a lot less
634 ;; vulnerable to glitches between the mbox and the active file.
636 (defun nnfolder-read-folder (file)
638 (nnfolder-possibly-activate-groups nil)
639 ;; We should be paranoid here and make sure the group is in the alist,
640 ;; and add it if it isn't.
641 ;;(if (not (assoc nnfoler-current-group nnfolder-group-alist)
642 (set-buffer (setq nnfolder-current-buffer
643 (nnheader-find-file-noselect file nil 'raw)))
644 (buffer-disable-undo (current-buffer))
645 (let* ((delim (concat "^" message-unix-mail-delimiter))
646 (marker (concat "\n" nnfolder-article-marker))
648 (active (cadr (assoc nnfolder-current-group
649 nnfolder-group-alist)))
650 ;; Set min to Big Number.
651 (min (max (1- (lsh 1 23)) (1- (lsh 1 24)) (1- (lsh 1 25))))
654 (goto-char (point-min))
656 ;; Anytime the active number is 1 or 0, it is suspect. In that case,
657 ;; search the file manually to find the active number. Or, of course,
658 ;; if we're being paranoid. (This would also be the place to build
659 ;; other lists from the header markers, such as expunge lists, etc., if
660 ;; we ever desired to abandon the active file entirely for mboxes.)
661 (when (or nnfolder-ignore-active-file
663 (while (and (search-forward marker nil t)
664 (re-search-forward number nil t))
665 (let ((newnum (string-to-number (match-string 0))))
666 (setq max (max max newnum))
667 (setq min (min min newnum))))
668 (setcar active (max 1 (min min max)))
669 (setcdr active (max max (cdr active)))
670 (goto-char (point-min)))
672 ;; Keep track of the active number on our own, and insert it back into
673 ;; the active list when we're done. Also, prime the pump to cut down on
674 ;; the number of searches we do.
675 (setq end (point-marker))
676 (set-marker end (or (and (re-search-forward delim nil t)
679 (while (not (= end (point-max)))
680 (setq start (marker-position end))
682 ;; There may be more than one "From " line, so we skip past
684 (while (looking-at delim)
686 (set-marker end (or (and (re-search-forward delim nil t)
690 (if (not (search-forward marker end t))
692 (narrow-to-region start end)
693 (nnmail-insert-lines)
694 (nnfolder-insert-newsgroup-line
695 (cons nil (nnfolder-active-number nnfolder-current-group)))
698 ;; Make absolutely sure that the active list reflects reality!
699 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
703 (defun nnfolder-generate-active-file ()
704 "Look for mbox folders in the nnfolder directory and make them into groups."
706 (nnmail-activate 'nnfolder)
707 (let ((files (directory-files nnfolder-directory))
709 (while (setq file (pop files))
710 (when (nnheader-mail-file-mbox-p file)
711 (nnheader-message 5 "Adding group %s..." file)
712 (push (list file (cons 1 0)) nnfolder-group-alist)
713 (nnfolder-read-folder file)
714 (nnfolder-close-group file))
717 (defun nnfolder-group-pathname (group)
718 "Make pathname for GROUP."
719 (let ((dir (file-name-as-directory (expand-file-name nnfolder-directory))))
720 ;; If this file exists, we use it directly.
721 (if (or nnmail-use-long-file-names
722 (file-exists-p (concat dir group)))
724 ;; If not, we translate dots into slashes.
725 (concat dir (nnheader-replace-chars-in-string group ?. ?/)))))
727 (defun nnfolder-save-buffer ()
729 (when (buffer-modified-p)
730 (run-hooks 'nnfolder-save-buffer-hook)
735 ;;; nnfolder.el ends here