1 ;;; nnsoup.el --- SOUP 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.
33 (eval-when-compile (require 'cl))
35 (defvar nnsoup-directory "~/SOUP/"
36 "*SOUP packet directory.")
38 (defvar nnsoup-tmp-directory "/tmp/"
39 "*Where nnsoup will store temporary files.")
41 (defvar nnsoup-replies-directory (concat nnsoup-directory "replies/")
42 "*Directory where outgoing packets will be composed.")
44 (defvar nnsoup-replies-format-type ?n
45 "*Format of the replies packages.")
47 (defvar nnsoup-replies-index-type ?n
48 "*Index type of the replies packages.")
50 (defvar nnsoup-active-file (concat nnsoup-directory "active")
53 (defvar nnsoup-packer "tar cf - %s | gzip > $HOME/Soupin%d.tgz"
54 "Format string command for packing a SOUP packet.
55 The SOUP files will be inserted where the %s is in the string.
56 This string MUST contain both %s and %d. The file number will be
57 inserted where %d appears.")
59 (defvar nnsoup-unpacker "gunzip -c %s | tar xvf -"
60 "*Format string command for unpacking a SOUP packet.
61 The SOUP packet file name will be inserted at the %s.")
63 (defvar nnsoup-packet-directory "~/"
64 "*Where nnsoup will look for incoming packets.")
66 (defvar nnsoup-packet-regexp "Soupout"
67 "*Regular expression matching SOUP packets in `nnsoup-packet-directory'.")
71 (defconst nnsoup-version "nnsoup 0.0"
74 (defvar nnsoup-status-string "")
75 (defvar nnsoup-group-alist nil)
76 (defvar nnsoup-current-prefix 0)
77 (defvar nnsoup-replies-list nil)
78 (defvar nnsoup-buffers nil)
79 (defvar nnsoup-current-group nil)
85 (defvar nnsoup-current-server nil)
86 (defvar nnsoup-server-alist nil)
87 (defvar nnsoup-server-variables
88 `((nnsoup-directory ,nnsoup-directory)
89 (nnsoup-active-file ,nnsoup-active-file)
90 (nnsoup-status-string "")
91 (nnsoup-current-prefix 0)
92 (nnsoup-group-alist nil)))
96 ;;; Interface functions.
98 (defun nnsoup-retrieve-headers (sequence &optional group server fetch-old)
99 (nnsoup-possibly-change-group group)
101 (set-buffer nntp-server-buffer)
103 (let ((areas (cddr (assoc nnsoup-current-group nnsoup-group-alist)))
106 useful-areas this-area-seq msg-buf)
107 (if (stringp (car sequence))
108 ;; We don't support fetching by Message-ID.
110 ;; We go through all the areas and find which files the
111 ;; articles in SEQUENCE come from.
112 (while (and areas sequence)
113 ;; Peel off areas that are below sequence.
114 (while (and areas (< (cdr (car (car areas))) (car sequence)))
115 (setq areas (cdr areas)))
117 ;; This is a useful area.
118 (push (car areas) useful-areas)
119 (setq this-area-seq nil)
120 ;; We take note whether this MSG has a corresponding IDX
122 (when (or (= (gnus-soup-encoding-index
123 (gnus-soup-area-encoding (nth 1 (car areas)))) ?n)
126 (gnus-soup-area-prefix (nth 1 (car areas)))))))
128 ;; We assign the portion of `sequence' that is relevant to
129 ;; this MSG packet to this packet.
130 (while (and sequence (<= (car sequence) (cdr (car (car areas)))))
131 (push (car sequence) this-area-seq)
132 (setq sequence (cdr sequence)))
133 (setcar useful-areas (cons (nreverse this-area-seq)
134 (car useful-areas)))))
136 ;; We now have a list of article numbers and corresponding
138 (setq useful-areas (nreverse useful-areas))
140 ;; Two different approaches depending on whether all the MSG
141 ;; files have corresponding IDX files. If they all do, we
142 ;; simply return the relevant IDX files and let Gnus sort out
143 ;; what lines are relevant. If some of the IDX files are
144 ;; missing, we must return HEADs for all the articles.
146 ;; We have IDX files for all areas.
149 (goto-char (point-max))
151 (number (car (nth 1 (car useful-areas))))
152 (index-buffer (nnsoup-index-buffer
153 (gnus-soup-area-prefix
154 (nth 2 (car useful-areas))))))
156 (insert-buffer-substring index-buffer)
158 ;; We have to remove the index number entires and
159 ;; insert article numbers instead.
160 (while (looking-at "[0-9]+")
161 (replace-match (int-to-string number) t t)
164 (setq useful-areas (cdr useful-areas)))
168 (setq articles (car (car useful-areas))
169 useful-areas (cdr useful-areas))
172 (nnsoup-narrow-to-article
173 (car articles) (cdr (car useful-areas)) 'head))
174 (goto-char (point-max))
175 (insert (format "221 %d Article retrieved.\n" (car articles)))
176 (insert-buffer-substring msg-buf)
177 (goto-char (point-max))
179 (setq articles (cdr articles))))
181 (nnheader-fold-continuation-lines)
184 (defun nnsoup-open-server (server &optional defs)
185 (nnheader-change-server 'nnsoup server defs)
186 (when (not (file-exists-p nnsoup-directory))
188 (make-directory nnsoup-directory t)
191 ((not (file-exists-p nnsoup-directory))
192 (nnsoup-close-server)
193 (nnheader-report 'nnsoup "Couldn't create directory: %s" nnsoup-directory))
194 ((not (file-directory-p (file-truename nnsoup-directory)))
195 (nnsoup-close-server)
196 (nnheader-report 'nnsoup "Not a directory: %s" nnsoup-directory))
198 (nnsoup-read-active-file)
199 (nnheader-report 'nnsoup "Opened server %s using directory %s"
200 server nnsoup-directory)
203 (defun nnsoup-close-server (&optional server)
204 (setq nnsoup-current-server nil
205 nnsoup-group-alist nil)
208 (defun nnsoup-request-close ()
209 (nnsoup-write-active-file)
210 (nnsoup-write-replies)
211 (gnus-soup-save-areas)
212 ;; Kill all nnsoup buffers.
214 (while nnsoup-buffers
215 (setq buffer (cdr (pop nnsoup-buffers)))
218 (kill-buffer buffer))))
219 (setq nnsoup-group-alist nil
220 nnsoup-current-group nil
221 nnsoup-current-server nil
222 nnsoup-server-alist nil
223 nnsoup-replies-list nil)
226 (defun nnsoup-server-opened (&optional server)
227 (and (equal server nnsoup-current-server)
229 (buffer-name nntp-server-buffer)))
231 (defun nnsoup-status-message (&optional server)
232 nnsoup-status-string)
234 (defun nnsoup-request-article (id &optional newsgroup server buffer)
235 (nnsoup-possibly-change-group newsgroup)
236 (let ((buffer (or buffer nntp-server-buffer)))
242 (insert-buffer-substring
243 (nnsoup-narrow-to-article id))
246 (defun nnsoup-request-group (group &optional server dont-check)
247 (nnsoup-possibly-change-group group)
250 (let ((active (cadr (assoc group nnsoup-group-alist))))
252 (nnheader-report 'nnsoup "No such group: %s" group)
255 (max (1+ (- (cdr active) (car active))) 0)
256 (car active) (cdr active) group)))))
258 (defun nnsoup-request-type (group &optional article)
259 (nnsoup-possibly-change-group group)
262 (let ((kind (gnus-soup-encoding-kind
263 (gnus-soup-area-encoding
264 (nth 1 (nnsoup-article-to-area
265 article nnsoup-current-group))))))
266 (cond ((= kind ?m) 'mail)
270 (defun nnsoup-close-group (group &optional server)
271 ;; Kill all nnsoup buffers.
272 (let ((buffers nnsoup-buffers)
275 (when (equal (car (setq elem (pop buffers))) group)
276 (setq nnsoup-buffers (delq elem nnsoup-buffers))
277 (and (cdr elem) (buffer-name (cdr elem))
278 (kill-buffer (cdr elem))))))
281 (defun nnsoup-request-list (&optional server)
283 (set-buffer nntp-server-buffer)
285 (let ((alist nnsoup-group-alist)
287 (while (setq entry (pop alist))
288 (insert (format "%s %d %d y\n" (car entry)
289 (cdadr entry) (caadr entry))))
292 (defun nnsoup-request-scan (group &optional server)
293 (nnsoup-unpack-packets))
295 (defun nnsoup-request-newgroups (date &optional server)
296 (nnsoup-request-list))
298 (defun nnsoup-request-list-newsgroups (&optional server)
301 (defun nnsoup-request-post (&optional server)
302 (nnsoup-store-reply "news")
305 (defun nnsoup-request-mail ()
306 (nnsoup-store-reply "mail")
309 (defun nnsoup-request-expire-articles (articles group &optional server force)
310 (nnsoup-possibly-change-group group)
311 (let* ((total-infolist (assoc group nnsoup-group-alist))
312 (active (cadr total-infolist))
313 (infolist (cddr total-infolist))
314 info range-list mod-time prefix)
316 (setq info (pop infolist)
317 range-list (gnus-uncompress-range (car info))
318 prefix (gnus-soup-area-prefix (nth 1 info)))
319 (when ;; All the articles in this file are marked for expiry.
320 (and (or (setq mod-time (nth 5 (file-attributes
321 (nnsoup-file prefix))))
322 (setq mod-time (nth 5 (file-attributes
323 (nnsoup-file prefix t)))))
324 (gnus-sublist-p articles range-list)
325 ;; This file is old enough.
326 (nnmail-expired-article-p group mod-time force))
327 ;; Ok, we delete this file.
328 (when (condition-case nil
331 5 "Deleting %s in group %s..." (nnsoup-file prefix)
333 (when (file-exists-p (nnsoup-file prefix))
334 (delete-file (nnsoup-file prefix)))
336 5 "Deleting %s in group..." (nnsoup-file prefix t)
338 (when (file-exists-p (nnsoup-file prefix t))
339 (delete-file (nnsoup-file prefix t)))
342 (setcdr (cdr total-infolist) (delq info (cddr total-infolist)))
343 (setq articles (gnus-sorted-complement articles range-list))))
345 (setcdr (cdr total-infolist) (delq info (cddr total-infolist)))))
346 (if (cddr total-infolist)
347 (setcar active (car (car (car (cdr (cdr total-infolist))))))
348 (setcar active (1+ (cdr active))))
349 (nnsoup-write-active-file)
350 ;; Return the articles that weren't expired.
354 ;;; Internal functions
356 (defun nnsoup-possibly-change-group (group &optional force)
358 (setq nnsoup-current-group group)
361 (defun nnsoup-read-active-file ()
362 (setq nnsoup-group-alist)
363 (when (file-exists-p nnsoup-active-file)
365 (load nnsoup-active-file)
367 ;; Be backwards compatible.
368 (when (and nnsoup-group-alist
369 (not (atom (caadar nnsoup-group-alist))))
370 (let ((alist nnsoup-group-alist)
372 (while (setq e (cdr (setq entry (pop alist))))
377 (setcdr entry (cons (cons min max) (cdr entry))))))
380 (defun nnsoup-write-active-file ()
381 (when nnsoup-group-alist
383 (set-buffer (get-buffer-create " *nnsoup work*"))
384 (buffer-disable-undo (current-buffer))
386 (insert (format "(setq nnsoup-group-alist '%S)\n" nnsoup-group-alist))
387 (insert (format "(setq nnsoup-current-prefix %d)\n"
388 nnsoup-current-prefix))
389 (write-region (point-min) (point-max) nnsoup-active-file
391 (kill-buffer (current-buffer)))))
393 (defun nnsoup-next-prefix ()
394 "Return the next free prefix."
396 (while (or (file-exists-p
397 (nnsoup-file (setq prefix (int-to-string
398 nnsoup-current-prefix))))
399 (file-exists-p (nnsoup-file prefix t)))
400 (incf nnsoup-current-prefix))
401 (incf nnsoup-current-prefix)
404 (defun nnsoup-read-areas ()
406 (set-buffer nntp-server-buffer)
407 (let ((areas (gnus-soup-parse-areas (concat nnsoup-tmp-directory "AREAS")))
408 entry number area lnum cur-prefix file)
409 ;; Go through all areas in the new AREAS file.
410 (while (setq area (pop areas))
411 ;; Change the name to the permanent name and move the files.
412 (setq cur-prefix (nnsoup-next-prefix))
413 (message "Incorporating file %s..." cur-prefix)
415 (setq file (concat nnsoup-tmp-directory
416 (gnus-soup-area-prefix area) ".IDX")))
417 (rename-file file (nnsoup-file cur-prefix)))
419 (setq file (concat nnsoup-tmp-directory
420 (gnus-soup-area-prefix area) ".MSG")))
421 (rename-file file (nnsoup-file cur-prefix t))
422 (gnus-soup-set-area-prefix area cur-prefix)
423 ;; Find the number of new articles in this area.
424 (setq number (nnsoup-number-of-articles area))
425 (if (not (setq entry (assoc (gnus-soup-area-name area)
426 nnsoup-group-alist)))
427 ;; If this is a new area (group), we just add this info to
429 (push (list (gnus-soup-area-name area)
431 (list (cons 1 number) area))
433 ;; There are already articles in this group, so we add this
434 ;; info to the end of the entry.
435 (nconc entry (list (list (cons (1+ (setq lnum (cdadr entry)))
438 (setcdr (cadr entry) (+ lnum number))))))
439 (nnsoup-write-active-file)
440 (delete-file (concat nnsoup-tmp-directory "AREAS"))))
442 (defun nnsoup-number-of-articles (area)
445 ;; If the number is in the area info, we just return it.
446 ((gnus-soup-area-number area)
447 (gnus-soup-area-number area))
448 ;; If there is an index file, we just count the lines.
449 ((/= (gnus-soup-encoding-index (gnus-soup-area-encoding area)) ?n)
450 (set-buffer (nnsoup-index-buffer (gnus-soup-area-prefix area)))
451 (count-lines (point-min) (point-max)))
452 ;; We do it the hard way - re-searching through the message
455 (set-buffer (nnsoup-message-buffer (gnus-soup-area-prefix area)))
456 (goto-char (point-min))
457 (let ((regexp (nnsoup-header (gnus-soup-encoding-format
458 (gnus-soup-area-encoding area))))
460 (while (re-search-forward regexp nil t)
464 (defun nnsoup-index-buffer (prefix &optional message)
465 (let* ((file (concat prefix (if message ".MSG" ".IDX")))
466 (buffer-name (concat " *nnsoup " file "*")))
467 (or (get-buffer buffer-name) ; File aready loaded.
468 (when (file-exists-p (concat nnsoup-directory file))
469 (save-excursion ; Load the file.
470 (set-buffer (get-buffer-create buffer-name))
471 (buffer-disable-undo (current-buffer))
472 (push (cons nnsoup-current-group (current-buffer)) nnsoup-buffers)
473 (insert-file-contents (concat nnsoup-directory file))
474 (current-buffer))))))
476 (defun nnsoup-file (prefix &optional message)
478 (concat nnsoup-directory prefix (if message ".MSG" ".IDX"))))
480 (defun nnsoup-message-buffer (prefix)
481 (nnsoup-index-buffer prefix 'msg))
483 (defun nnsoup-unpack-packets ()
484 "Unpack all packets in `nnsoup-packet-directory'."
485 (let ((packets (directory-files
486 nnsoup-packet-directory t nnsoup-packet-regexp))
488 (while (setq packet (pop packets))
489 (message (format "nnsoup: unpacking %s..." packet))
490 (if (not (gnus-soup-unpack-packet
491 nnsoup-tmp-directory nnsoup-unpacker packet))
492 (message "Couldn't unpack %s" packet)
495 (message "Unpacking...done")))))
497 (defun nnsoup-narrow-to-article (article &optional area head)
498 (let* ((area (or area (nnsoup-article-to-area article nnsoup-current-group)))
499 (prefix (gnus-soup-area-prefix (nth 1 area)))
500 (msg-buf (nnsoup-index-buffer prefix 'msg))
504 ;; There is no MSG file.
508 ;; We use the index file to find out where the article begins and ends.
509 ((and (= (gnus-soup-encoding-index
510 (gnus-soup-area-encoding (nth 1 area)))
512 (file-exists-p (nnsoup-file prefix)))
513 (set-buffer (nnsoup-index-buffer prefix))
515 (goto-char (point-min))
516 (forward-line (- article (car (car area))))
517 (setq beg (read (current-buffer)))
519 (if (looking-at "[0-9]+")
521 (setq end (read (current-buffer)))
524 (let ((format (gnus-soup-encoding-format
525 (gnus-soup-area-encoding (nth 1 area)))))
527 (if (or (= format ?n) (= format ?m))
528 (setq end (progn (forward-line -1) (point))))))
529 (set-buffer msg-buf))
531 (narrow-to-region beg (or end (point-max))))
535 (goto-char (point-min))
536 (let ((header (nnsoup-header
537 (gnus-soup-encoding-format
538 (gnus-soup-area-encoding (nth 1 area))))))
539 (re-search-forward header nil t (- article (car (car area))))
542 (if (re-search-forward header nil t)
545 (goto-char (point-min))
550 (if (search-forward "\n\n" nil t)
555 (defun nnsoup-header (format)
558 "^#! *rnews +[0-9]+ *$")
560 (concat "^" rmail-unix-mail-delimiter))
564 (error "Unknown format: %c" format))))
567 (defun nnsoup-pack-replies ()
568 "Make an outbound package of SOUP replies."
570 ;; Write all data buffers.
571 (gnus-soup-save-areas)
572 ;; Write the active file.
573 (nnsoup-write-active-file)
574 ;; Write the REPLIES file.
575 (nnsoup-write-replies)
576 ;; Pack all these files into a SOUP packet.
577 (gnus-soup-pack nnsoup-replies-directory nnsoup-packer))
579 (defun nnsoup-write-replies ()
580 "Write the REPLIES file."
581 (when nnsoup-replies-list
582 (gnus-soup-write-replies nnsoup-replies-directory nnsoup-replies-list)
583 (setq nnsoup-replies-list nil)))
585 (defun nnsoup-article-to-area (article group)
586 "Return the area that ARTICLE in GROUP is located in."
587 (let ((areas (cddr (assoc group nnsoup-group-alist))))
588 (while (and areas (< (cdr (car (car areas))) article))
589 (setq areas (cdr areas)))
590 (and areas (car areas))))
592 (defvar nnsoup-old-functions
593 (list gnus-inews-article-function send-mail-function))
596 (defun nnsoup-set-variables ()
597 "Use the SOUP methods for posting news and mailing mail."
599 (setq gnus-inews-article-function 'nnsoup-request-post)
600 (setq send-mail-function 'nnsoup-request-mail))
603 (defun nnsoup-revert-variables ()
604 "Revert posting and mailing methods to the standard Emacs methods."
606 (setq gnus-inews-article-function (car nnsoup-old-functions))
607 (setq send-mail-function (cadr nnsoup-old-functions)))
609 (defun nnsoup-store-reply (kind)
610 ;; Mostly stolen from `sendmail.el'.
611 (let ((tembuf (generate-new-buffer " sendmail temp"))
612 (case-fold-search nil)
613 (mailbuf (current-buffer))
618 (insert-buffer-substring mailbuf)
619 (goto-char (point-max))
620 ;; require one newline at the end.
621 (or (= (preceding-char) ?\n)
623 ;; Change header-delimiter to be what sendmail expects.
624 (goto-char (point-min))
625 (if (re-search-forward
626 (concat "^" (regexp-quote mail-header-separator) "\n") nil t)
628 (search-forward "\n\n" nil t))
630 (setq delimline (point-marker))
631 (if mail-aliases (expand-mail-aliases (point-min) delimline))
632 (goto-char (point-min))
633 ;; ignore any blank lines in the header
634 (while (and (re-search-forward "\n\n\n*" delimline t)
635 (< (point) delimline))
636 (replace-match "\n"))
637 (let ((case-fold-search t))
638 (goto-char (point-min))
639 ;; Find and handle any FCC fields.
640 (goto-char (point-min))
641 (if (re-search-forward "^FCC:" delimline t)
642 (mail-do-fcc delimline))
643 (goto-char (point-min))
644 ;; "S:" is an abbreviation for "Subject:".
645 (goto-char (point-min))
646 (if (re-search-forward "^S:" delimline t)
647 (replace-match "Subject:"))
648 ;; Don't send out a blank subject line
649 (goto-char (point-min))
650 (if (re-search-forward "^Subject:[ \t]*\n" delimline t)
652 ;; Insert an extra newline if we need it to work around
653 ;; Sun's bug that swallows newlines.
654 (goto-char (1+ delimline))
655 (if (eval mail-mailer-swallows-blank-line)
659 nnsoup-replies-directory
660 (nnsoup-kind-to-prefix kind) nil nnsoup-replies-format-type
661 nnsoup-replies-index-type))
663 (when (and msg-buf (bufferp msg-buf))
666 (goto-char (point-min))
667 (while (re-search-forward "^#! *rnews" nil t)
669 (message "Stored %d messages" num)))
670 (nnsoup-write-replies)
671 (kill-buffer tembuf))))
673 (defun nnsoup-kind-to-prefix (kind)
674 (unless nnsoup-replies-list
675 (setq nnsoup-replies-list
676 (gnus-soup-parse-replies
677 (concat nnsoup-replies-directory "REPLIES"))))
678 (let ((replies nnsoup-replies-list))
680 (not (string= kind (gnus-soup-reply-kind (car replies)))))
681 (setq replies (cdr replies)))
683 (gnus-soup-reply-prefix (car replies))
684 (setq nnsoup-replies-list
685 (cons (vector (gnus-soup-unique-prefix nnsoup-replies-directory)
688 nnsoup-replies-format-type
689 nnsoup-replies-index-type
690 (if (string= kind "news")
692 nnsoup-replies-list))
693 (gnus-soup-reply-prefix (car nnsoup-replies-list)))))
695 (defun nnsoup-make-active ()
696 "(Re-)create the SOUP active file."
698 (let ((files (sort (directory-files nnsoup-directory t "IDX$")
700 (< (progn (string-match "/\\([0-9]+\\)\\." f1)
701 (string-to-int (match-string 1 f1)))
702 (progn (string-match "/\\([0-9]+\\)\\." f2)
703 (string-to-int (match-string 1 f2)))))))
704 active group lines ident elem min)
705 (set-buffer (get-buffer-create " *nnsoup work*"))
706 (buffer-disable-undo (current-buffer))
708 (message "Doing %s..." (car files))
710 (insert-file-contents (car files))
711 (goto-char (point-min))
713 (re-search-backward "[ \t]\\([^ ]+\\):[0-9]")
714 (setq group (buffer-substring (match-beginning 1) (match-end 1)))
715 (setq lines (count-lines (point-min) (point-max)))
716 (setq ident (progn (string-match
717 "/\\([0-9]+\\)\\." (car files))
719 (car files) (match-beginning 1)
721 (if (not (setq elem (assoc group active)))
722 (push (list group (cons 1 lines)
724 (vector ident group "ncm" "" lines)))
728 (list (cons (setq min (1+ (cdr (car (car
731 (vector ident group "ncm" "" lines))))
732 (setcdr (cadr elem) (+ min lines)))
733 (setq files (cdr files)))
735 (setq nnsoup-group-alist active)
737 (setcdr (car active) (nreverse (cdr (car active))))
738 (setq active (cdr active)))
739 (nnsoup-write-active-file)))
741 (defun nnsoup-delete-unreferenced-message-files ()
742 "Delete any *.MSG and *.IDX files that aren't known by nnsoup."
744 (let* ((known (apply 'nconc (mapcar
748 (gnus-soup-area-prefix (cadr area)))
750 nnsoup-group-alist)))
751 (regexp "\\.MSG$\\|\\.IDX$")
752 (files (directory-files nnsoup-directory nil regexp))
754 ;; Find all files that aren't known by nnsoup.
755 (while (setq file (pop files))
756 (string-match regexp file)
757 (unless (member (substring file 0 (match-beginning 0)) known)
758 (push file non-files)))
759 ;; Sort and delete the files.
760 (setq non-files (sort non-files 'string<))
761 (map-y-or-n-p "Delete file %s? "
762 (lambda (file) (delete-file (concat nnsoup-directory file)))
767 ;;; nnsoup.el ends here