(Fcommand_execute): New arg SPECIAL. All callers changed.
[emacs.git] / lisp / nnml.el
blob2daf354e0563a57d1ada5a598158420b05b5ba1f
1 ;;; nnml.el --- mail spool access for Gnus
3 ;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;; Author: 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)
14 ;; any later version.
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.
26 ;;; Commentary:
28 ;; Based on nnspool.el by Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>.
29 ;; For an overview of what the interface functions do, please see the
30 ;; Gnus sources.
32 ;;; Code:
34 (require 'nnheader)
35 (require 'nnmail)
37 (defvar nnml-directory "~/Mail/"
38 "Mail spool directory.")
40 (defvar nnml-active-file (concat nnml-directory "active")
41 "Mail active file.")
43 (defvar nnml-newsgroups-file (concat nnml-directory "newsgroups")
44 "Mail newsgroups description file.")
46 (defvar nnml-get-new-mail t
47 "If non-nil, nnml will check the incoming mail file and split the mail.")
49 (defvar nnml-nov-is-evil nil
50 "If non-nil, Gnus will never generate and use nov databases for mail groups.
51 Using nov databases will speed up header fetching considerably.
52 This variable shouldn't be flipped much. If you have, for some reason,
53 set this to t, and want to set it to nil again, you should always run
54 the `nnml-generate-nov-databases' command. The function will go
55 through all nnml directories and generate nov databases for them
56 all. This may very well take some time.")
58 (defvar nnml-prepare-save-mail-hook nil
59 "Hook run narrowed to an article before saving.")
63 (defconst nnml-version "nnml 1.0"
64 "nnml version.")
66 (defvar nnml-nov-file-name ".overview")
68 (defvar nnml-current-directory nil)
69 (defvar nnml-status-string "")
70 (defvar nnml-nov-buffer-alist nil)
71 (defvar nnml-group-alist nil)
72 (defvar nnml-active-timestamp nil)
76 ;; Server variables.
78 (defvar nnml-current-server nil)
79 (defvar nnml-server-alist nil)
80 (defvar nnml-server-variables
81 (list
82 (list 'nnml-directory nnml-directory)
83 (list 'nnml-active-file nnml-active-file)
84 (list 'nnml-newsgroups-file nnml-newsgroups-file)
85 (list 'nnml-get-new-mail nnml-get-new-mail)
86 (list 'nnml-nov-is-evil nnml-nov-is-evil)
87 (list 'nnml-nov-file-name nnml-nov-file-name)
88 '(nnml-current-directory nil)
89 '(nnml-status-string "")
90 '(nnml-nov-buffer-alist nil)
91 '(nnml-group-alist nil)
92 '(nnml-active-timestamp nil)))
96 ;;; Interface functions.
98 (defun nnml-retrieve-headers (sequence &optional newsgroup server)
99 (save-excursion
100 (set-buffer nntp-server-buffer)
101 (erase-buffer)
102 (let ((file nil)
103 (number (length sequence))
104 (count 0)
105 beg article)
106 (if (stringp (car sequence))
107 'headers
108 (nnml-possibly-change-directory newsgroup)
109 (if (nnml-retrieve-headers-with-nov sequence)
110 'nov
111 (while sequence
112 (setq article (car sequence))
113 (setq file
114 (concat nnml-current-directory (int-to-string article)))
115 (if (and (file-exists-p file)
116 (not (file-directory-p file)))
117 (progn
118 (insert (format "221 %d Article retrieved.\n" article))
119 (setq beg (point))
120 (nnheader-insert-head file)
121 (goto-char beg)
122 (if (search-forward "\n\n" nil t)
123 (forward-char -1)
124 (goto-char (point-max))
125 (insert "\n\n"))
126 (insert ".\n")
127 (delete-region (point) (point-max))))
128 (setq sequence (cdr sequence))
129 (setq count (1+ count))
130 (and (numberp nnmail-large-newsgroup)
131 (> number nnmail-large-newsgroup)
132 (zerop (% count 20))
133 gnus-verbose-backends
134 (message "nnml: Receiving headers... %d%%"
135 (/ (* count 100) number))))
137 (and (numberp nnmail-large-newsgroup)
138 (> number nnmail-large-newsgroup)
139 gnus-verbose-backends
140 (message "nnml: Receiving headers...done"))
142 ;; Fold continuation lines.
143 (goto-char (point-min))
144 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
145 (replace-match " " t t))
146 'headers)))))
148 (defun nnml-open-server (server &optional defs)
149 (nnheader-init-server-buffer)
150 (if (equal server nnml-current-server)
152 (if nnml-current-server
153 (setq nnml-server-alist
154 (cons (list nnml-current-server
155 (nnheader-save-variables nnml-server-variables))
156 nnml-server-alist)))
157 (let ((state (assoc server nnml-server-alist)))
158 (if state
159 (progn
160 (nnheader-restore-variables (nth 1 state))
161 (setq nnml-server-alist (delq state nnml-server-alist)))
162 (nnheader-set-init-variables nnml-server-variables defs)))
163 (setq nnml-current-server server)))
165 (defun nnml-close-server (&optional server)
168 (defun nnml-server-opened (&optional server)
169 (and (equal server nnml-current-server)
170 nntp-server-buffer
171 (buffer-name nntp-server-buffer)))
173 (defun nnml-status-message (&optional server)
174 nnml-status-string)
176 (defun nnml-request-article (id &optional newsgroup server buffer)
177 (nnml-possibly-change-directory newsgroup)
178 (let ((file (if (stringp id)
180 (concat nnml-current-directory (int-to-string id))))
181 (nntp-server-buffer (or buffer nntp-server-buffer)))
182 (if (and (stringp file)
183 (file-exists-p file)
184 (not (file-directory-p file)))
185 (save-excursion
186 (nnmail-find-file file)))))
188 (defun nnml-request-group (group &optional server dont-check)
189 (if (not (nnml-possibly-change-directory group))
190 (progn
191 (setq nnml-status-string "Invalid group (no such directory)")
192 nil)
193 (if dont-check
195 (nnml-get-new-mail group)
196 (nnmail-activate 'nnml)
197 (let ((active (nth 1 (assoc group nnml-group-alist))))
198 (save-excursion
199 (set-buffer nntp-server-buffer)
200 (erase-buffer)
201 (if (not active)
203 (insert (format "211 %d %d %d %s\n"
204 (max (1+ (- (cdr active) (car active))) 0)
205 (car active) (cdr active) group))
206 t))))))
208 (defun nnml-close-group (group &optional server)
211 (defun nnml-request-close ()
212 (setq nnml-current-server nil)
213 (setq nnml-server-alist nil)
216 (defun nnml-request-create-group (group &optional server)
217 (nnmail-activate 'nnml)
218 (or (assoc group nnml-group-alist)
219 (let (active)
220 (setq nnml-group-alist (cons (list group (setq active (cons 1 0)))
221 nnml-group-alist))
222 (nnml-possibly-create-directory group)
223 (nnml-possibly-change-directory group)
224 (let ((articles (mapcar
225 (lambda (file)
226 (string-to-int file))
227 (directory-files
228 nnml-current-directory nil "^[0-9]+$"))))
229 (and articles
230 (progn
231 (setcar active (apply 'min articles))
232 (setcdr active (apply 'max articles)))))
233 (nnmail-save-active nnml-group-alist nnml-active-file)))
236 (defun nnml-request-list (&optional server)
237 (if server (nnml-get-new-mail))
238 (save-excursion
239 (nnmail-find-file nnml-active-file)
240 (setq nnml-group-alist (nnmail-get-active))))
242 (defun nnml-request-newgroups (date &optional server)
243 (nnml-request-list server))
245 (defun nnml-request-list-newsgroups (&optional server)
246 (save-excursion
247 (nnmail-find-file nnml-newsgroups-file)))
249 (defun nnml-request-post (&optional server)
250 (mail-send-and-exit nil))
252 (defalias 'nnml-request-post-buffer 'nnmail-request-post-buffer)
254 (defun nnml-request-expire-articles (articles newsgroup &optional server force)
255 (nnml-possibly-change-directory newsgroup)
256 (let* ((days (or (and nnmail-expiry-wait-function
257 (funcall nnmail-expiry-wait-function newsgroup))
258 nnmail-expiry-wait))
259 (active-articles
260 (mapcar
261 (function
262 (lambda (name)
263 (string-to-int name)))
264 (directory-files nnml-current-directory nil "^[0-9]+$" t)))
265 (max-article (and active-articles (apply 'max active-articles)))
266 (is-old t)
267 article rest mod-time)
268 (nnmail-activate 'nnml)
270 (while (and articles is-old)
271 (setq article (concat nnml-current-directory
272 (int-to-string (car articles))))
273 (if (setq mod-time (nth 5 (file-attributes article)))
274 (if (and (or (not nnmail-keep-last-article)
275 (not max-article)
276 (not (= (car articles) max-article)))
277 (or force
278 (and (not (equal mod-time '(0 0)))
279 (setq is-old
280 (> (nnmail-days-between
281 (current-time-string)
282 (current-time-string mod-time))
283 days)))))
284 (progn
285 (and gnus-verbose-backends
286 (message "Deleting article %s..." article))
287 (condition-case ()
288 (delete-file article)
289 (file-error
290 (setq rest (cons (car articles) rest))))
291 (setq active-articles (delq (car articles) active-articles))
292 (nnml-nov-delete-article newsgroup (car articles)))
293 (setq rest (cons (car articles) rest))))
294 (setq articles (cdr articles)))
295 (let ((active (nth 1 (assoc newsgroup nnml-group-alist))))
296 (and active
297 (setcar active (or (and active-articles
298 (apply 'min active-articles))
299 0)))
300 (nnmail-save-active nnml-group-alist nnml-active-file))
301 (nnml-save-nov)
302 (message "")
303 (nconc rest articles)))
305 (defun nnml-request-move-article
306 (article group server accept-form &optional last)
307 (let ((buf (get-buffer-create " *nnml move*"))
308 result)
309 (and
310 (nnml-request-article article group server)
311 (save-excursion
312 (set-buffer buf)
313 (insert-buffer-substring nntp-server-buffer)
314 (setq result (eval accept-form))
315 (kill-buffer (current-buffer))
316 result)
317 (progn
318 (condition-case ()
319 (delete-file (concat nnml-current-directory
320 (int-to-string article)))
321 (file-error nil))
322 (nnml-nov-delete-article group article)
323 (and last (nnml-save-nov))))
324 result))
326 (defun nnml-request-accept-article (group &optional last)
327 (let (result)
328 (if (stringp group)
329 (and
330 (nnmail-activate 'nnml)
331 ;; We trick the choosing function into believing that only one
332 ;; group is available.
333 (let ((nnmail-split-methods (list (list group ""))))
334 (setq result (car (nnml-save-mail))))
335 (progn
336 (nnmail-save-active nnml-group-alist nnml-active-file)
337 (and last (nnml-save-nov))))
338 (and
339 (nnmail-activate 'nnml)
340 (setq result (car (nnml-save-mail)))
341 (progn
342 (nnmail-save-active nnml-group-alist nnml-active-file)
343 (and last (nnml-save-nov)))))
344 result))
346 (defun nnml-request-replace-article (article group buffer)
347 (nnml-possibly-change-directory group)
348 (save-excursion
349 (set-buffer buffer)
350 (nnml-possibly-create-directory group)
351 (if (not (condition-case ()
352 (progn
353 (write-region (point-min) (point-max)
354 (concat nnml-current-directory
355 (int-to-string article))
356 nil (if gnus-verbose-backends nil 'nomesg))
358 (error nil)))
360 (let ((chars (nnmail-insert-lines))
361 (art (concat (int-to-string article) "\t"))
362 nov-line)
363 (setq nov-line (nnml-make-nov-line chars))
364 ;; Replace the NOV line in the NOV file.
365 (save-excursion
366 (set-buffer (nnml-open-nov group))
367 (goto-char (point-min))
368 (if (or (looking-at art)
369 (search-forward (concat "\n" art) nil t))
370 ;; Delete the old NOV line.
371 (delete-region (progn (beginning-of-line) (point))
372 (progn (forward-line 1) (point)))
373 ;; The line isn't here, so we have to find out where
374 ;; we should insert it. (This situation should never
375 ;; occur, but one likes to make sure...)
376 (while (and (looking-at "[0-9]+\t")
377 (< (string-to-int
378 (buffer-substring
379 (match-beginning 0) (match-end 0)))
380 article)
381 (zerop (forward-line 1)))))
382 (beginning-of-line)
383 (insert (int-to-string article) nov-line)
384 (nnml-save-nov)
385 t)))))
389 ;;; Internal functions
391 (defun nnml-retrieve-headers-with-nov (articles)
392 (if (or gnus-nov-is-evil nnml-nov-is-evil)
394 (let ((first (car articles))
395 (last (progn (while (cdr articles) (setq articles (cdr articles)))
396 (car articles)))
397 (nov (concat nnml-current-directory nnml-nov-file-name)))
398 (if (file-exists-p nov)
399 (save-excursion
400 (set-buffer nntp-server-buffer)
401 (erase-buffer)
402 (insert-file-contents nov)
403 (goto-char (point-min))
404 (while (and (not (eobp)) (< first (read (current-buffer))))
405 (forward-line 1))
406 (beginning-of-line)
407 (if (not (eobp)) (delete-region 1 (point)))
408 (while (and (not (eobp)) (>= last (read (current-buffer))))
409 (forward-line 1))
410 (beginning-of-line)
411 (if (not (eobp)) (delete-region (point) (point-max)))
412 t)))))
414 (defun nnml-possibly-change-directory (newsgroup &optional force)
415 (if newsgroup
416 (let ((pathname (nnmail-article-pathname newsgroup nnml-directory)))
417 (and (or force (file-directory-p pathname))
418 (setq nnml-current-directory pathname)))
421 (defun nnml-possibly-create-directory (group)
422 (let (dir dirs)
423 (setq dir (nnmail-article-pathname group nnml-directory))
424 (while (not (file-directory-p dir))
425 (setq dirs (cons dir dirs))
426 (setq dir (file-name-directory (directory-file-name dir))))
427 (while dirs
428 (make-directory (directory-file-name (car dirs)))
429 (and gnus-verbose-backends
430 (message "Creating mail directory %s" (car dirs)))
431 (setq dirs (cdr dirs)))))
433 (defun nnml-save-mail ()
434 "Called narrowed to an article."
435 (let ((group-art (nreverse (nnmail-article-group 'nnml-active-number)))
436 chars nov-line)
437 (setq chars (nnmail-insert-lines))
438 (nnmail-insert-xref group-art)
439 (run-hooks 'nnml-prepare-save-mail-hook)
440 (goto-char (point-min))
441 (while (looking-at "From ")
442 (replace-match "X-From-Line: ")
443 (forward-line 1))
444 ;; We save the article in all the newsgroups it belongs in.
445 (let ((ga group-art)
446 first)
447 (while ga
448 (nnml-possibly-create-directory (car (car ga)))
449 (let ((file (concat (nnmail-article-pathname
450 (car (car ga)) nnml-directory)
451 (int-to-string (cdr (car ga))))))
452 (if first
453 ;; It was already saved, so we just make a hard link.
454 (add-name-to-file first file t)
455 ;; Save the article.
456 (write-region (point-min) (point-max) file nil
457 (if gnus-verbose-backends nil 'nomesg))
458 (setq first file)))
459 (setq ga (cdr ga))))
460 ;; Generate a nov line for this article. We generate the nov
461 ;; line after saving, because nov generation destroys the
462 ;; header.
463 (setq nov-line (nnml-make-nov-line chars))
464 ;; Output the nov line to all nov databases that should have it.
465 (let ((ga group-art))
466 (while ga
467 (nnml-add-nov (car (car ga)) (cdr (car ga)) nov-line)
468 (setq ga (cdr ga))))
469 group-art))
471 (defun nnml-active-number (group)
472 "Compute the next article number in GROUP."
473 (let ((active (car (cdr (assoc group nnml-group-alist)))))
474 ;; The group wasn't known to nnml, so we just create an active
475 ;; entry for it.
476 (or active
477 (progn
478 (setq active (cons 1 0))
479 (setq nnml-group-alist (cons (list group active) nnml-group-alist))))
480 (setcdr active (1+ (cdr active)))
481 (while (file-exists-p
482 (concat (nnmail-article-pathname group nnml-directory)
483 (int-to-string (cdr active))))
484 (setcdr active (1+ (cdr active))))
485 (cdr active)))
487 (defun nnml-get-new-mail (&optional group)
488 "Read new incoming mail."
489 (let* ((spools (nnmail-get-spool-files group))
490 (group-in group)
491 incoming incomings)
492 (if (or (not nnml-get-new-mail) (not nnmail-spool-file))
494 ;; We first activate all the groups.
495 (nnmail-activate 'nnml)
496 ;; The we go through all the existing spool files and split the
497 ;; mail from each.
498 (while spools
499 (and
500 (file-exists-p (car spools))
501 (> (nth 7 (file-attributes (car spools))) 0)
502 (progn
503 (and gnus-verbose-backends
504 (message "nnml: Reading incoming mail..."))
505 (if (not (setq incoming
506 (nnmail-move-inbox
507 (car spools) (concat nnml-directory "Incoming"))))
509 (setq group (nnmail-get-split-group (car spools) group-in))
510 (nnmail-split-incoming incoming 'nnml-save-mail nil group)
511 (setq incomings (cons incoming incomings)))))
512 (setq spools (cdr spools)))
513 ;; If we did indeed read any incoming spools, we save all info.
514 (if incoming
515 (progn
516 (nnmail-save-active nnml-group-alist nnml-active-file)
517 (nnml-save-nov)
518 (run-hooks 'nnmail-read-incoming-hook)
519 (and gnus-verbose-backends
520 (message "nnml: Reading incoming mail...done"))))
521 (while incomings
522 (setq incoming (car incomings))
523 (and nnmail-delete-incoming
524 (file-exists-p incoming)
525 (file-writable-p incoming)
526 (delete-file incoming))
527 (setq incomings (cdr incomings))))))
530 (defun nnml-add-nov (group article line)
531 "Add a nov line for the GROUP base."
532 (save-excursion
533 (set-buffer (nnml-open-nov group))
534 (goto-char (point-max))
535 (insert (int-to-string article) line)))
537 (defsubst nnml-header-value ()
538 (buffer-substring (match-end 0) (save-excursion (end-of-line) (point))))
540 (defun nnml-make-nov-line (chars)
541 "Create a nov from the current headers."
542 (let ((case-fold-search t)
543 subject from date id references lines xref in-reply-to char)
544 (save-excursion
545 (save-restriction
546 (goto-char (point-min))
547 (narrow-to-region
548 (point)
549 (1- (or (search-forward "\n\n" nil t) (point-max))))
550 ;; Fold continuation lines.
551 (goto-char (point-min))
552 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
553 (replace-match " " t t))
554 (subst-char-in-region (point-min) (point-max) ?\t ? )
555 ;; [number subject from date id references chars lines xref]
556 (save-excursion
557 (goto-char (point-min))
558 (while (re-search-forward "^\\(from\\|subject\\|message-id\\|date\\|lines\\|xref\\|references\\|in-reply-to\\): "
559 nil t)
560 (beginning-of-line)
561 (setq char (downcase (following-char)))
562 (cond
563 ((eq char ?s)
564 (setq subject (nnml-header-value)))
565 ((eq char ?f)
566 (setq from (nnml-header-value)))
567 ((eq char ?x)
568 (setq xref (nnml-header-value)))
569 ((eq char ?l)
570 (setq lines (nnml-header-value)))
571 ((eq char ?d)
572 (setq date (nnml-header-value)))
573 ((eq char ?m)
574 (setq id (setq id (nnml-header-value))))
575 ((eq char ?r)
576 (setq references (nnml-header-value)))
577 ((eq char ?i)
578 (setq in-reply-to (nnml-header-value))))
579 (forward-line 1))
581 (and (not references)
582 in-reply-to
583 (string-match "<[^>]+>" in-reply-to)
584 (setq references
585 (substring in-reply-to (match-beginning 0)
586 (match-end 0)))))
587 ;; [number subject from date id references chars lines xref]
588 (format "\t%s\t%s\t%s\t%s\t%s\t%d\t%s\t%s\t\n"
589 (or subject "(none)")
590 (or from "(nobody)") (or date "")
591 (or id (concat "nnml-dummy-id-"
592 (mapconcat
593 (lambda (time) (int-to-string time))
594 (current-time) "-")))
595 (or references "")
596 (or chars 0) (or lines "0") (or xref ""))))))
598 (defun nnml-open-nov (group)
599 (or (cdr (assoc group nnml-nov-buffer-alist))
600 (let ((buffer (find-file-noselect
601 (concat (nnmail-article-pathname
602 group nnml-directory) nnml-nov-file-name))))
603 (save-excursion
604 (set-buffer buffer)
605 (buffer-disable-undo (current-buffer)))
606 (setq nnml-nov-buffer-alist
607 (cons (cons group buffer) nnml-nov-buffer-alist))
608 buffer)))
610 (defun nnml-save-nov ()
611 (save-excursion
612 (while nnml-nov-buffer-alist
613 (if (buffer-name (cdr (car nnml-nov-buffer-alist)))
614 (progn
615 (set-buffer (cdr (car nnml-nov-buffer-alist)))
616 (and (buffer-modified-p)
617 (write-region
618 1 (point-max) (buffer-file-name) nil 'nomesg))
619 (set-buffer-modified-p nil)
620 (kill-buffer (current-buffer))))
621 (setq nnml-nov-buffer-alist (cdr nnml-nov-buffer-alist)))))
623 ;;;###autoload
624 (defun nnml-generate-nov-databases (dir)
625 "Generate nov databases in all nnml mail newsgroups."
626 (interactive
627 (progn
628 (setq nnml-group-alist nil)
629 (list nnml-directory)))
630 (nnml-open-server (or nnml-current-server ""))
631 (let ((dirs (directory-files dir t nil t)))
632 (while dirs
633 (if (and (not (string-match "/\\.\\.$" (car dirs)))
634 (not (string-match "/\\.$" (car dirs)))
635 (file-directory-p (car dirs)))
636 (nnml-generate-nov-databases (car dirs)))
637 (setq dirs (cdr dirs))))
638 (let ((files (sort
639 (mapcar
640 (function
641 (lambda (name)
642 (string-to-int name)))
643 (directory-files dir nil "^[0-9]+$" t))
644 (function <)))
645 (nov (concat dir "/" nnml-nov-file-name))
646 (nov-buffer (get-buffer-create "*nov*"))
647 nov-line chars)
648 (if files
649 (setq nnml-group-alist
650 (cons (list (nnmail-replace-chars-in-string
651 (substring (expand-file-name dir)
652 (length (expand-file-name
653 nnml-directory)))
654 ?/ ?.)
655 (cons (car files)
656 (let ((f files))
657 (while (cdr f) (setq f (cdr f)))
658 (car f))))
659 nnml-group-alist)))
660 (if files
661 (save-excursion
662 (set-buffer nntp-server-buffer)
663 (if (file-exists-p nov)
664 (delete-file nov))
665 (save-excursion
666 (set-buffer nov-buffer)
667 (buffer-disable-undo (current-buffer))
668 (erase-buffer))
669 (while files
670 (erase-buffer)
671 (insert-file-contents (concat dir "/" (int-to-string (car files))))
672 (goto-char (point-min))
673 (narrow-to-region 1 (save-excursion (search-forward "\n\n" nil t)
674 (setq chars (- (point-max)
675 (point)))
676 (point)))
677 (if (not (= 0 chars)) ; none of them empty files...
678 (progn
679 (setq nov-line (nnml-make-nov-line chars))
680 (save-excursion
681 (set-buffer nov-buffer)
682 (goto-char (point-max))
683 (insert (int-to-string (car files)) nov-line))))
684 (widen)
685 (setq files (cdr files)))
686 (save-excursion
687 (set-buffer nov-buffer)
688 (write-region 1 (point-max) (expand-file-name nov) nil
689 'nomesg)
690 (kill-buffer (current-buffer)))))
691 (nnmail-save-active nnml-group-alist nnml-active-file)))
693 (defun nnml-nov-delete-article (group article)
694 (save-excursion
695 (set-buffer (nnml-open-nov group))
696 (goto-char (point-min))
697 (if (re-search-forward (concat "^" (int-to-string article) "\t") nil t)
698 (delete-region (match-beginning 0) (progn (forward-line 1) (point))))
701 (provide 'nnml)
703 ;;; nnml.el ends here