1 ;;; nnml.el --- mail spool access for Gnus
2 ;; Copyright (C) 1995,96 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
5 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6 ;; Keywords: news, mail
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; Based on nnspool.el by Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>.
28 ;; For an overview of what the interface functions do, please see the
40 (defvoo nnml-directory message-directory
41 "Mail spool directory.")
43 (defvoo nnml-active-file
44 (concat (file-name-as-directory nnml-directory) "active")
47 (defvoo nnml-newsgroups-file
48 (concat (file-name-as-directory nnml-directory) "newsgroups")
49 "Mail newsgroups description file.")
51 (defvoo nnml-get-new-mail t
52 "If non-nil, nnml will check the incoming mail file and split the mail.")
54 (defvoo nnml-nov-is-evil nil
55 "If non-nil, Gnus will never generate and use nov databases for mail groups.
56 Using nov databases will speed up header fetching considerably.
57 This variable shouldn't be flipped much. If you have, for some reason,
58 set this to t, and want to set it to nil again, you should always run
59 the `nnml-generate-nov-databases' command. The function will go
60 through all nnml directories and generate nov databases for them
61 all. This may very well take some time.")
63 (defvoo nnml-prepare-save-mail-hook nil
64 "Hook run narrowed to an article before saving.")
66 (defvoo nnml-inhibit-expiry nil
67 "If non-nil, inhibit expiry.")
72 (defconst nnml-version "nnml 1.0"
75 (defvoo nnml-nov-file-name ".overview")
77 (defvoo nnml-current-directory nil)
78 (defvoo nnml-current-group nil)
79 (defvoo nnml-status-string "")
80 (defvoo nnml-nov-buffer-alist nil)
81 (defvoo nnml-group-alist nil)
82 (defvoo nnml-active-timestamp nil)
83 (defvoo nnml-article-file-alist nil)
85 (defvoo nnml-generate-active-function 'nnml-generate-active-info)
89 ;;; Interface functions.
91 (nnoo-define-basics nnml)
93 (deffoo nnml-retrieve-headers (sequence &optional newsgroup server fetch-old)
95 (set-buffer nntp-server-buffer)
98 (number (length sequence))
101 (if (stringp (car sequence))
103 (nnml-possibly-change-directory newsgroup server)
104 (unless nnml-article-file-alist
105 (setq nnml-article-file-alist
106 (nnheader-article-to-file-alist nnml-current-directory)))
107 (if (nnml-retrieve-headers-with-nov sequence fetch-old)
110 (setq article (car sequence))
112 (concat nnml-current-directory
113 (or (cdr (assq article nnml-article-file-alist))
115 (when (and (file-exists-p file)
116 (not (file-directory-p file)))
117 (insert (format "221 %d Article retrieved.\n" article))
119 (nnheader-insert-head file)
121 (if (search-forward "\n\n" nil t)
123 (goto-char (point-max))
126 (delete-region (point) (point-max)))
127 (setq sequence (cdr sequence))
128 (setq count (1+ count))
129 (and (numberp nnmail-large-newsgroup)
130 (> number nnmail-large-newsgroup)
132 (nnheader-message 6 "nnml: Receiving headers... %d%%"
133 (/ (* count 100) number))))
135 (and (numberp nnmail-large-newsgroup)
136 (> number nnmail-large-newsgroup)
137 (nnheader-message 6 "nnml: Receiving headers...done"))
139 (nnheader-fold-continuation-lines)
142 (deffoo nnml-open-server (server &optional defs)
143 (nnoo-change-server 'nnml server defs)
144 (when (not (file-exists-p nnml-directory))
146 (make-directory nnml-directory t)
149 ((not (file-exists-p nnml-directory))
151 (nnheader-report 'nnml "Couldn't create directory: %s" nnml-directory))
152 ((not (file-directory-p (file-truename nnml-directory)))
154 (nnheader-report 'nnml "Not a directory: %s" nnml-directory))
156 (nnheader-report 'nnml "Opened server %s using directory %s"
157 server nnml-directory)
160 (defun nnml-request-regenerate (server)
161 (nnml-possibly-change-directory nil server)
162 (nnml-generate-nov-databases))
164 (deffoo nnml-request-article (id &optional newsgroup server buffer)
165 (nnml-possibly-change-directory newsgroup server)
166 (let* ((nntp-server-buffer (or buffer nntp-server-buffer))
167 path gpath group-num)
169 (when (and (setq group-num (nnml-find-group-number id))
171 (assq (cdr group-num)
172 (nnheader-article-to-file-alist
174 (nnmail-group-pathname
177 (setq path (concat gpath (int-to-string (cdr group-num)))))
178 (setq path (nnml-article-to-file id)))
181 (nnheader-report 'nnml "No such article: %s" id))
182 ((not (file-exists-p path))
183 (nnheader-report 'nnml "No such file: %s" path))
184 ((file-directory-p path)
185 (nnheader-report 'nnml "File is a directory: %s" path))
186 ((not (save-excursion (nnmail-find-file path)))
187 (nnheader-report 'nnml "Couldn't read file: %s" path))
189 (nnheader-report 'nnml "Article %s retrieved" id)
190 ;; We return the article number.
191 (cons newsgroup (string-to-int (file-name-nondirectory path)))))))
193 (deffoo nnml-request-group (group &optional server dont-check)
195 ((not (nnml-possibly-change-directory group server))
196 (nnheader-report 'nnml "Invalid group (no such directory)"))
197 ((not (file-exists-p nnml-current-directory))
198 (nnheader-report 'nnml "Directory %s does not exist"
199 nnml-current-directory))
200 ((not (file-directory-p nnml-current-directory))
201 (nnheader-report 'nnml "%s is not a directory" nnml-current-directory))
203 (nnheader-report 'nnml "Group %s selected" group)
206 (nnheader-re-read-dir nnml-current-directory)
207 (nnmail-activate 'nnml)
208 (let ((active (nth 1 (assoc group nnml-group-alist))))
210 (nnheader-report 'nnml "No such group: %s" group)
211 (nnheader-report 'nnml "Selected group %s" group)
212 (nnheader-insert "211 %d %d %d %s\n"
213 (max (1+ (- (cdr active) (car active))) 0)
214 (car active) (cdr active) group))))))
216 (deffoo nnml-request-scan (&optional group server)
217 (setq nnml-article-file-alist nil)
218 (nnml-possibly-change-directory group server)
219 (nnmail-get-new-mail 'nnml 'nnml-save-nov nnml-directory group))
221 (deffoo nnml-close-group (group &optional server)
222 (setq nnml-article-file-alist nil)
225 (deffoo nnml-request-create-group (group &optional server args)
226 (nnmail-activate 'nnml)
227 (unless (assoc group nnml-group-alist)
229 (push (list group (setq active (cons 1 0)))
231 (nnml-possibly-create-directory group)
232 (nnml-possibly-change-directory group server)
233 (let ((articles (nnheader-directory-articles nnml-current-directory)))
235 (setcar active (apply 'min articles))
236 (setcdr active (apply 'max articles))))
237 (nnmail-save-active nnml-group-alist nnml-active-file)))
240 (deffoo nnml-request-list (&optional server)
242 (nnmail-find-file nnml-active-file)
243 (setq nnml-group-alist (nnmail-get-active))
246 (deffoo nnml-request-newgroups (date &optional server)
247 (nnml-request-list server))
249 (deffoo nnml-request-list-newsgroups (&optional server)
251 (nnmail-find-file nnml-newsgroups-file)))
253 (deffoo nnml-request-expire-articles (articles newsgroup &optional server force)
254 (nnml-possibly-change-directory newsgroup server)
255 (let* ((active-articles
256 (nnheader-directory-articles nnml-current-directory))
258 article rest mod-time number)
259 (nnmail-activate 'nnml)
261 (unless nnml-article-file-alist
262 (setq nnml-article-file-alist
263 (nnheader-article-to-file-alist nnml-current-directory)))
265 (while (and articles is-old)
266 (setq article (concat nnml-current-directory
268 (setq number (pop articles)))))
269 (when (setq mod-time (nth 5 (file-attributes article)))
270 (if (and (nnml-deletable-article-p newsgroup number)
272 (nnmail-expired-article-p newsgroup mod-time force
273 nnml-inhibit-expiry)))
275 (nnheader-message 5 "Deleting article %s in %s..."
278 (funcall nnmail-delete-file-function article)
281 (setq active-articles (delq number active-articles))
282 (nnml-nov-delete-article newsgroup number))
283 (push number rest))))
284 (let ((active (nth 1 (assoc newsgroup nnml-group-alist))))
286 (setcar active (or (and active-articles
287 (apply 'min active-articles))
289 (nnmail-save-active nnml-group-alist nnml-active-file))
292 (nconc rest articles)))
294 (deffoo nnml-request-move-article
295 (article group server accept-form &optional last)
296 (let ((buf (get-buffer-create " *nnml move*"))
298 (nnml-possibly-change-directory group server)
299 (unless nnml-article-file-alist
300 (setq nnml-article-file-alist
301 (nnheader-article-to-file-alist nnml-current-directory)))
303 (nnml-deletable-article-p group article)
304 (nnml-request-article article group server)
307 (insert-buffer-substring nntp-server-buffer)
308 (setq result (eval accept-form))
309 (kill-buffer (current-buffer))
312 (nnml-possibly-change-directory group server)
314 (funcall nnmail-delete-file-function
315 (concat nnml-current-directory
316 (int-to-string article)))
318 (nnml-nov-delete-article group article)
319 (and last (nnml-save-nov))))
322 (deffoo nnml-request-accept-article (group &optional server last)
323 (nnml-possibly-change-directory group server)
324 (nnmail-check-syntax)
328 (nnmail-activate 'nnml)
329 (setq result (car (nnml-save-mail
330 (list (cons group (nnml-active-number group))))))
332 (nnmail-save-active nnml-group-alist nnml-active-file)
333 (and last (nnml-save-nov))))
335 (nnmail-activate 'nnml)
336 (setq result (car (nnml-save-mail
337 (nnmail-article-group 'nnml-active-number))))
339 (nnmail-save-active nnml-group-alist nnml-active-file)
340 (and last (nnml-save-nov)))))
343 (deffoo nnml-request-replace-article (article group buffer)
344 (nnml-possibly-change-directory group)
347 (nnml-possibly-create-directory group)
348 (let ((chars (nnmail-insert-lines))
349 (art (concat (int-to-string article) "\t"))
351 (when (condition-case ()
354 (point-min) (point-max)
355 (concat nnml-current-directory
356 (int-to-string article))
357 nil (if (nnheader-be-verbose 5) nil 'nomesg))
360 (setq headers (nnml-parse-head chars article))
361 ;; Replace the NOV line in the NOV file.
363 (set-buffer (nnml-open-nov group))
364 (goto-char (point-min))
365 (if (or (looking-at art)
366 (search-forward (concat "\n" art) nil t))
367 ;; Delete the old NOV line.
368 (delete-region (progn (beginning-of-line) (point))
369 (progn (forward-line 1) (point)))
370 ;; The line isn't here, so we have to find out where
371 ;; we should insert it. (This situation should never
372 ;; occur, but one likes to make sure...)
373 (while (and (looking-at "[0-9]+\t")
376 (match-beginning 0) (match-end 0)))
378 (zerop (forward-line 1)))))
380 (nnheader-insert-nov headers)
384 (deffoo nnml-request-delete-group (group &optional force server)
385 (nnml-possibly-change-directory group server)
387 ;; Delete all articles in GROUP.
390 nnml-current-directory t
391 (concat nnheader-numerical-short-files
392 "\\|" (regexp-quote nnml-nov-file-name) "$")))
395 (setq article (pop articles))
396 (when (file-writable-p article)
397 (nnheader-message 5 "Deleting article %s in %s..." article group)
398 (funcall nnmail-delete-file-function article))))
399 ;; Try to delete the directory itself.
401 (delete-directory nnml-current-directory)
403 ;; Remove the group from all structures.
404 (setq nnml-group-alist
405 (delq (assoc group nnml-group-alist) nnml-group-alist)
406 nnml-current-group nil
407 nnml-current-directory nil)
408 ;; Save the active file.
409 (nnmail-save-active nnml-group-alist nnml-active-file)
412 (deffoo nnml-request-rename-group (group new-name &optional server)
413 (nnml-possibly-change-directory group server)
414 (let ((new-dir (nnmail-group-pathname new-name nnml-directory))
415 (old-dir (nnmail-group-pathname group nnml-directory)))
416 (when (condition-case ()
418 (make-directory new-dir t)
421 ;; We move the articles file by file instead of renaming
422 ;; the directory -- there may be subgroups in this group.
423 ;; One might be more clever, I guess.
424 (let ((files (nnheader-article-to-file-alist old-dir)))
427 (concat old-dir (cdar files))
428 (concat new-dir (cdar files)))
430 ;; Move .overview file.
431 (let ((overview (concat old-dir nnml-nov-file-name)))
432 (when (file-exists-p overview)
433 (rename-file overview (concat new-dir nnml-nov-file-name))))
434 (when (<= (length (directory-files old-dir)) 2)
436 (delete-directory old-dir)
438 ;; That went ok, so we change the internal structures.
439 (let ((entry (assoc group nnml-group-alist)))
441 (setcar entry new-name))
442 (setq nnml-current-directory nil
443 nnml-current-group nil)
444 ;; Save the new group alist.
445 (nnmail-save-active nnml-group-alist nnml-active-file)
448 (deffoo nnml-set-status (article name value &optional group server)
449 (nnml-possibly-change-directory group server)
450 (let ((file (nnml-article-to-file article)))
452 ((not (file-exists-p file))
453 (nnheader-report 'nnml "File %s does not exist" file))
455 (nnheader-temp-write file
456 (nnheader-insert-file-contents file)
457 (nnmail-replace-status name value))
461 ;;; Internal functions.
463 (defun nnml-article-to-file (article)
464 (unless nnml-article-file-alist
465 (setq nnml-article-file-alist
466 (nnheader-article-to-file-alist nnml-current-directory)))
468 (when (setq file (cdr (assq article nnml-article-file-alist)))
469 (concat nnml-current-directory file))))
471 (defun nnml-deletable-article-p (group article)
472 "Say whether ARTICLE in GROUP can be deleted."
474 (when (setq file (cdr (assq article nnml-article-file-alist)))
475 (setq path (concat nnml-current-directory file))
476 (when (file-writable-p path)
477 (or (not nnmail-keep-last-article)
478 (not (eq (cdr (nth 1 (assoc group nnml-group-alist)))
481 ;; Find an article number in the current group given the Message-ID.
482 (defun nnml-find-group-number (id)
484 (set-buffer (get-buffer-create " *nnml id*"))
485 (buffer-disable-undo (current-buffer))
486 (let ((alist nnml-group-alist)
488 ;; We want to look through all .overview files, but we want to
489 ;; start with the one in the current directory. It seems most
490 ;; likely that the article we are looking for is in that group.
491 (if (setq number (nnml-find-id nnml-current-group id))
492 (cons nnml-current-group number)
493 ;; It wasn't there, so we look through the other groups as well.
494 (while (and (not number)
496 (or (string= (caar alist) nnml-current-group)
497 (setq number (nnml-find-id (caar alist) id)))
499 (setq alist (cdr alist))))
501 (cons (caar alist) number))))))
503 (defun nnml-find-id (group id)
505 (let ((nov (concat (nnmail-group-pathname group nnml-directory)
508 (when (file-exists-p nov)
509 (nnheader-insert-file-contents nov)
510 (while (and (not found)
511 (search-forward id nil t)) ; We find the ID.
512 ;; And the id is in the fourth field.
513 (if (not (and (search-backward "\t" nil t 4)
514 (not (search-backward"\t" (gnus-point-at-bol) t))))
518 ;; We return the article number.
521 (read (current-buffer))
525 (defun nnml-retrieve-headers-with-nov (articles &optional fetch-old)
526 (if (or gnus-nov-is-evil nnml-nov-is-evil)
528 (let ((first (car articles))
529 (last (progn (while (cdr articles) (setq articles (cdr articles)))
531 (nov (concat nnml-current-directory nnml-nov-file-name)))
532 (when (file-exists-p nov)
534 (set-buffer nntp-server-buffer)
536 (nnheader-insert-file-contents nov)
538 (not (numberp fetch-old)))
539 t ; Don't remove anything.
541 (setq first (max 1 (- first fetch-old))))
542 (goto-char (point-min))
543 (while (and (not (eobp)) (> first (read (current-buffer))))
547 (delete-region 1 (point)))
548 (while (and (not (eobp)) (>= last (read (current-buffer))))
552 (delete-region (point) (point-max)))
555 (defun nnml-possibly-change-directory (group &optional server)
557 (not (nnml-server-opened server)))
558 (nnml-open-server server))
560 (let ((pathname (nnmail-group-pathname group nnml-directory)))
561 (when (not (equal pathname nnml-current-directory))
562 (setq nnml-current-directory pathname
563 nnml-current-group group
564 nnml-article-file-alist nil))))
567 (defun nnml-possibly-create-directory (group)
569 (setq dir (nnmail-group-pathname group nnml-directory))
570 (while (not (file-directory-p dir))
572 (setq dir (file-name-directory (directory-file-name dir))))
574 (make-directory (directory-file-name (car dirs)))
575 (nnheader-message 5 "Creating mail directory %s" (car dirs))
576 (setq dirs (cdr dirs)))))
578 (defun nnml-save-mail (group-art)
579 "Called narrowed to an article."
581 (setq chars (nnmail-insert-lines))
582 (nnmail-insert-xref group-art)
583 (run-hooks 'nnmail-prepare-save-mail-hook)
584 (run-hooks 'nnml-prepare-save-mail-hook)
585 (goto-char (point-min))
586 (while (looking-at "From ")
587 (replace-match "X-From-Line: ")
589 ;; We save the article in all the newsgroups it belongs in.
593 (nnml-possibly-create-directory (caar ga))
594 (let ((file (concat (nnmail-group-pathname
595 (caar ga) nnml-directory)
596 (int-to-string (cdar ga)))))
598 ;; It was already saved, so we just make a hard link.
599 (funcall nnmail-crosspost-link-function first file t)
601 (nnmail-write-region (point-min) (point-max) file nil
602 (if (nnheader-be-verbose 5) nil 'nomesg))
605 ;; Generate a nov line for this article. We generate the nov
606 ;; line after saving, because nov generation destroys the
608 (setq headers (nnml-parse-head chars))
609 ;; Output the nov line to all nov databases that should have it.
610 (let ((ga group-art))
612 (nnml-add-nov (caar ga) (cdar ga) headers)
616 (defun nnml-active-number (group)
617 "Compute the next article number in GROUP."
618 (let ((active (cadr (assoc group nnml-group-alist))))
619 ;; The group wasn't known to nnml, so we just create an active
622 ;; Perhaps the active file was corrupt? See whether
623 ;; there are any articles in this group.
624 (nnml-possibly-create-directory group)
625 (nnml-possibly-change-directory group)
626 (unless nnml-article-file-alist
627 (setq nnml-article-file-alist
629 (nnheader-article-to-file-alist nnml-current-directory)
630 (lambda (a1 a2) (< (car a1) (car a2))))))
632 (if nnml-article-file-alist
633 (cons (caar nnml-article-file-alist)
634 (caar (last nnml-article-file-alist)))
636 (push (list group active) nnml-group-alist))
637 (setcdr active (1+ (cdr active)))
638 (while (file-exists-p
639 (concat (nnmail-group-pathname group nnml-directory)
640 (int-to-string (cdr active))))
641 (setcdr active (1+ (cdr active))))
644 (defun nnml-add-nov (group article headers)
645 "Add a nov line for the GROUP base."
647 (set-buffer (nnml-open-nov group))
648 (goto-char (point-max))
649 (mail-header-set-number headers article)
650 (nnheader-insert-nov headers)))
652 (defsubst nnml-header-value ()
653 (buffer-substring (match-end 0) (progn (end-of-line) (point))))
655 (defun nnml-parse-head (chars &optional number)
656 "Parse the head of the current buffer."
659 (goto-char (point-min))
662 (1- (or (search-forward "\n\n" nil t) (point-max))))
663 ;; Fold continuation lines.
664 (goto-char (point-min))
665 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
666 (replace-match " " t t))
667 ;; Remove any tabs; they are too confusing.
668 (subst-char-in-region (point-min) (point-max) ?\t ? )
669 (let ((headers (nnheader-parse-head t)))
670 (mail-header-set-chars headers chars)
671 (mail-header-set-number headers number)
674 (defun nnml-open-nov (group)
675 (or (cdr (assoc group nnml-nov-buffer-alist))
676 (let ((buffer (nnheader-find-file-noselect
677 (concat (nnmail-group-pathname group nnml-directory)
678 nnml-nov-file-name))))
681 (buffer-disable-undo (current-buffer)))
682 (push (cons group buffer) nnml-nov-buffer-alist)
685 (defun nnml-save-nov ()
687 (while nnml-nov-buffer-alist
688 (when (buffer-name (cdar nnml-nov-buffer-alist))
689 (set-buffer (cdar nnml-nov-buffer-alist))
690 (when (buffer-modified-p)
691 (nnmail-write-region 1 (point-max) (buffer-file-name) nil 'nomesg))
692 (set-buffer-modified-p nil)
693 (kill-buffer (current-buffer)))
694 (setq nnml-nov-buffer-alist (cdr nnml-nov-buffer-alist)))))
697 (defun nnml-generate-nov-databases ()
698 "Generate nov databases in all nnml directories."
700 ;; Read the active file to make sure we don't re-use articles
701 ;; numbers in empty groups.
702 (nnmail-activate 'nnml)
703 (nnml-open-server (or (nnoo-current-server 'nnml) ""))
704 (setq nnml-directory (expand-file-name nnml-directory))
705 ;; Recurse down the directories.
706 (nnml-generate-nov-databases-1 nnml-directory)
707 ;; Save the active file.
708 (nnmail-save-active nnml-group-alist nnml-active-file))
710 (defun nnml-generate-nov-databases-1 (dir &optional seen)
711 (setq dir (file-name-as-directory dir))
712 ;; Only scan this sub-tree if we haven't been here yet.
713 (unless (member (file-truename dir) seen)
714 (push (file-truename dir) seen)
715 ;; We descend recursively
716 (let ((dirs (directory-files dir t nil t))
718 (while (setq dir (pop dirs))
719 (when (and (not (member (file-name-nondirectory dir) '("." "..")))
720 (file-directory-p dir))
721 (nnml-generate-nov-databases-1 dir seen))))
722 ;; Do this directory.
725 (lambda (name) (string-to-int name))
726 (directory-files dir nil "^[0-9]+$" t))
729 (funcall nnml-generate-active-function dir)
730 ;; Generate the nov file.
731 (nnml-generate-nov-file dir files)))))
734 (defun nnml-generate-active-info (dir)
735 ;; Update the active info for this group.
736 (let ((group (nnheader-file-to-group
737 (directory-file-name dir) nnml-directory)))
738 (setq nnml-group-alist
739 (delq (assoc group nnml-group-alist) nnml-group-alist))
743 (while (cdr f) (setq f (cdr f)))
747 (defun nnml-generate-nov-file (dir files)
748 (let* ((dir (file-name-as-directory dir))
749 (nov (concat dir nnml-nov-file-name))
750 (nov-buffer (get-buffer-create " *nov*"))
753 ;; Init the nov buffer.
754 (set-buffer nov-buffer)
755 (buffer-disable-undo (current-buffer))
757 (set-buffer nntp-server-buffer)
758 ;; Delete the old NOV file.
759 (when (file-exists-p nov)
760 (funcall nnmail-delete-file-function nov))
762 (unless (file-directory-p
763 (setq file (concat dir (int-to-string (car files)))))
765 (nnheader-insert-file-contents file)
767 (goto-char (point-min))
769 (search-forward "\n\n" nil t)
770 (setq chars (- (point-max) (point)))
771 (max 1 (1- (point)))))
772 (when (and (not (= 0 chars)) ; none of them empty files...
773 (not (= (point-min) (point-max))))
774 (goto-char (point-min))
775 (setq headers (nnml-parse-head chars (car files)))
777 (set-buffer nov-buffer)
778 (goto-char (point-max))
779 (nnheader-insert-nov headers)))
781 (setq files (cdr files)))
783 (set-buffer nov-buffer)
784 (nnmail-write-region 1 (point-max) nov nil 'nomesg)
785 (kill-buffer (current-buffer))))))
787 (defun nnml-nov-delete-article (group article)
789 (set-buffer (nnml-open-nov group))
790 (goto-char (point-min))
791 (when (re-search-forward (concat "^" (int-to-string article) "\t") nil t)
792 (delete-region (match-beginning 0) (progn (forward-line 1) (point))))
797 ;;; nnml.el ends here