*** empty log message ***
[gnus] / lisp / gnus-cache.el
1 ;;; gnus-cache.el --- cache interface for Gnus
2 ;; Copyright (C) 1995,96 Free Software Foundation, Inc.
3
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
5 ;; Keywords: news
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 ;;; Commentary:
25
26 ;;; Code:
27
28 (require 'gnus-load)
29 (require 'gnus-int)
30 (require 'gnus-range)
31 (require 'gnus-sum)
32 (require 'gnus-start)
33 (require 'gnus)
34
35 (defvar gnus-cache-directory
36   (nnheader-concat gnus-directory "cache/")
37   "*The directory where cached articles will be stored.")
38
39 (defvar gnus-cache-active-file 
40   (concat (file-name-as-directory gnus-cache-directory) "active")
41   "*The cache active file.")
42
43 (defvar gnus-cache-enter-articles '(ticked dormant)
44   "*Classes of articles to enter into the cache.")
45
46 (defvar gnus-cache-remove-articles '(read)
47   "*Classes of articles to remove from the cache.")
48
49 (defvar gnus-uncacheable-groups nil
50   "*Groups that match this regexp will not be cached.
51
52 If you want to avoid caching your nnml groups, you could set this
53 variable to \"^nnml\".")
54
55 \f
56
57 ;;; Internal variables.
58
59 (defvar gnus-cache-removable-articles nil)
60 (defvar gnus-cache-buffer nil)
61 (defvar gnus-cache-active-hashtb nil)
62 (defvar gnus-cache-active-altered nil)
63
64 (eval-and-compile
65   (autoload 'nnml-generate-nov-databases-1 "nnml")
66   (autoload 'nnvirtual-find-group-art "nnvirtual"))
67
68 \f
69
70 ;;; Functions called from Gnus.
71
72 (defun gnus-cache-open ()
73   "Initialize the cache."
74   (when (or (file-exists-p gnus-cache-directory)
75             (and gnus-use-cache
76                  (not (eq gnus-use-cache 'passive))))
77     (gnus-cache-read-active)))
78
79 (condition-case ()
80     (gnus-add-shutdown 'gnus-cache-close 'gnus)
81   ;; Complexities of byte-compiling makes this kludge necessary.  Eeek.
82   (error nil))
83
84 (defun gnus-cache-close ()
85   "Shut down the cache."
86   (gnus-cache-write-active)
87   (gnus-cache-save-buffers)
88   (setq gnus-cache-active-hashtb nil))
89
90 (defun gnus-cache-save-buffers ()
91   ;; save the overview buffer if it exists and has been modified
92   ;; delete empty cache subdirectories
93   (when gnus-cache-buffer
94     (let ((buffer (cdr gnus-cache-buffer))
95           (overview-file (gnus-cache-file-name
96                           (car gnus-cache-buffer) ".overview")))
97       ;; write the overview only if it was modified
98       (when (buffer-modified-p buffer)
99         (save-excursion
100           (set-buffer buffer)
101           (if (> (buffer-size) 0)
102               ;; Non-empty overview, write it to a file.
103               (gnus-write-buffer overview-file)
104             ;; Empty overview file, remove it
105             (when (file-exists-p overview-file)
106               (delete-file overview-file))
107             ;; If possible, remove group's cache subdirectory.
108             (condition-case nil
109                 ;; FIXME: we can detect the error type and warn the user
110                 ;; of any inconsistencies (articles w/o nov entries?).
111                 ;; for now, just be conservative...delete only if safe -- sj
112                 (delete-directory (file-name-directory overview-file))
113               (error nil)))))
114       ;; Kill the buffer -- it's either unmodified or saved.
115       (gnus-kill-buffer buffer)
116       (setq gnus-cache-buffer nil))))
117
118 (defun gnus-cache-possibly-enter-article 
119   (group article headers ticked dormant unread &optional force)
120   (when (and (or force (not (eq gnus-use-cache 'passive)))
121              (numberp article)
122              (> article 0)
123              (vectorp headers))
124                                         ; This might be a dummy article.
125     ;; If this is a virtual group, we find the real group.
126     (when (gnus-virtual-group-p group)
127       (let ((result (nnvirtual-find-group-art 
128                      (gnus-group-real-name group) article)))
129         (setq group (car result)
130               headers (copy-sequence headers))
131         (mail-header-set-number headers (cdr result))))
132     (let ((number (mail-header-number headers))
133           file dir)
134       (when (and (> number 0)           ; Reffed article.
135                  (or force
136                      (and (or (not gnus-uncacheable-groups)
137                               (not (string-match
138                                     gnus-uncacheable-groups group)))
139                           (gnus-cache-member-of-class
140                            gnus-cache-enter-articles ticked dormant unread)))
141                  (not (file-exists-p (setq file (gnus-cache-file-name
142                                                  group number)))))
143         ;; Possibly create the cache directory.
144         (gnus-make-directory (setq dir (file-name-directory file)))
145         ;; Save the article in the cache.
146         (if (file-exists-p file)
147             t                           ; The article already is saved.
148           (save-excursion
149             (set-buffer nntp-server-buffer)
150             (let ((gnus-use-cache nil))
151               (gnus-request-article-this-buffer number group))
152             (when (> (buffer-size) 0)
153               (gnus-write-buffer file)
154               (gnus-cache-change-buffer group)
155               (set-buffer (cdr gnus-cache-buffer))
156               (goto-char (point-max))
157               (forward-line -1)
158               (while (condition-case ()
159                          (when (not (bobp))
160                            (> (read (current-buffer)) number))
161                        (error
162                         ;; The line was malformed, so we just remove it!!
163                         (gnus-delete-line)
164                         t))
165                 (forward-line -1))
166               (if (bobp)
167                   (if (not (eobp))
168                       (progn
169                         (beginning-of-line)
170                         (when (< (read (current-buffer)) number)
171                           (forward-line 1)))
172                     (beginning-of-line))
173                 (forward-line 1))
174               (beginning-of-line)
175               ;; [number subject from date id references chars lines xref]
176               (insert (format "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t\n"
177                               (mail-header-number headers)
178                               (mail-header-subject headers)
179                               (mail-header-from headers)
180                               (mail-header-date headers)
181                               (mail-header-id headers)
182                               (or (mail-header-references headers) "")
183                               (or (mail-header-chars headers) "")
184                               (or (mail-header-lines headers) "")
185                               (or (mail-header-xref headers) "")))
186               ;; Update the active info.
187               (set-buffer gnus-summary-buffer)
188               (gnus-cache-update-active group number)
189               (push article gnus-newsgroup-cached)
190               (gnus-summary-update-secondary-mark article))
191             t))))))
192
193 (defun gnus-cache-enter-remove-article (article)
194   "Mark ARTICLE for later possible removal."
195   (when article
196     (push article gnus-cache-removable-articles)))
197
198 (defun gnus-cache-possibly-remove-articles ()
199   "Possibly remove some of the removable articles."
200   (if (not (gnus-virtual-group-p gnus-newsgroup-name))
201       (gnus-cache-possibly-remove-articles-1)
202     (let ((arts gnus-cache-removable-articles)
203           ga)
204       (while arts
205         (when (setq ga (nnvirtual-find-group-art
206                         (gnus-group-real-name gnus-newsgroup-name) (pop arts)))
207           (let ((gnus-cache-removable-articles (list (cdr ga)))
208                 (gnus-newsgroup-name (car ga)))
209             (gnus-cache-possibly-remove-articles-1)))))
210     (setq gnus-cache-removable-articles nil)))
211
212 (defun gnus-cache-possibly-remove-articles-1 ()
213   "Possibly remove some of the removable articles."
214   (unless (eq gnus-use-cache 'passive)
215     (let ((articles gnus-cache-removable-articles)
216           (cache-articles gnus-newsgroup-cached)
217           article)
218       (gnus-cache-change-buffer gnus-newsgroup-name)
219       (while articles
220         (when (memq (setq article (pop articles)) cache-articles)
221           ;; The article was in the cache, so we see whether we are
222           ;; supposed to remove it from the cache.
223           (gnus-cache-possibly-remove-article
224            article (memq article gnus-newsgroup-marked)
225            (memq article gnus-newsgroup-dormant)
226            (or (memq article gnus-newsgroup-unreads)
227                (memq article gnus-newsgroup-unselected))))))
228     ;; The overview file might have been modified, save it
229     ;; safe because we're only called at group exit anyway.
230     (gnus-cache-save-buffers)))
231
232 (defun gnus-cache-request-article (article group)
233   "Retrieve ARTICLE in GROUP from the cache."
234   (let ((file (gnus-cache-file-name group article))
235         (buffer-read-only nil))
236     (when (file-exists-p file)
237       (erase-buffer)
238       (gnus-kill-all-overlays)
239       (insert-file-contents file)
240       t)))
241
242 (defun gnus-cache-possibly-alter-active (group active)
243   "Alter the ACTIVE info for GROUP to reflect the articles in the cache."
244   (when gnus-cache-active-hashtb
245     (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb)))
246       (and cache-active 
247            (< (car cache-active) (car active))
248            (setcar active (car cache-active)))
249       (and cache-active
250            (> (cdr cache-active) (cdr active))
251            (setcdr active (cdr cache-active))))))
252
253 (defun gnus-cache-retrieve-headers (articles group &optional fetch-old)
254   "Retrieve the headers for ARTICLES in GROUP."
255   (let ((cached 
256          (setq gnus-newsgroup-cached (gnus-cache-articles-in-group group))))
257     (if (not cached)
258         ;; No cached articles here, so we just retrieve them
259         ;; the normal way.
260         (let ((gnus-use-cache nil))
261           (gnus-retrieve-headers articles group fetch-old))
262       (let ((uncached-articles (gnus-sorted-intersection
263                                 (gnus-sorted-complement articles cached)
264                                 articles))
265             (cache-file (gnus-cache-file-name group ".overview"))
266             type)
267         ;; We first retrieve all the headers that we don't have in 
268         ;; the cache.
269         (let ((gnus-use-cache nil))
270           (when uncached-articles
271             (setq type (and articles 
272                             (gnus-retrieve-headers 
273                              uncached-articles group fetch-old)))))
274         (gnus-cache-save-buffers)
275         ;; Then we insert the cached headers.
276         (save-excursion
277           (cond
278            ((not (file-exists-p cache-file))
279             ;; There are no cached headers.
280             type)
281            ((null type)
282             ;; There were no uncached headers (or retrieval was 
283             ;; unsuccessful), so we use the cached headers exclusively.
284             (set-buffer nntp-server-buffer)
285             (erase-buffer)
286             (insert-file-contents cache-file)
287             'nov)
288            ((eq type 'nov)
289             ;; We have both cached and uncached NOV headers, so we
290             ;; braid them.
291             (gnus-cache-braid-nov group cached)
292             type)
293            (t
294             ;; We braid HEADs.
295             (gnus-cache-braid-heads group (gnus-sorted-intersection
296                                            cached articles))
297             type)))))))
298
299 (defun gnus-cache-enter-article (&optional n)
300   "Enter the next N articles into the cache.
301 If not given a prefix, use the process marked articles instead.
302 Returns the list of articles entered."
303   (interactive "P")
304   (gnus-set-global-variables)
305   (let ((articles (gnus-summary-work-articles n))
306         article out)
307     (while articles
308       (setq article (pop articles))
309       (when (gnus-cache-possibly-enter-article 
310              gnus-newsgroup-name article (gnus-summary-article-header article)
311              nil nil nil t)
312         (push article out))
313       (gnus-summary-remove-process-mark article)
314       (gnus-summary-update-secondary-mark article))
315     (gnus-summary-next-subject 1)
316     (gnus-summary-position-point)
317     (nreverse out)))
318
319 (defun gnus-cache-remove-article (n)
320   "Remove the next N articles from the cache.
321 If not given a prefix, use the process marked articles instead.
322 Returns the list of articles removed."
323   (interactive "P")
324   (gnus-set-global-variables)
325   (gnus-cache-change-buffer gnus-newsgroup-name)
326   (let ((articles (gnus-summary-work-articles n))
327         article out)
328     (while articles
329       (setq article (pop articles))
330       (when (gnus-cache-possibly-remove-article article nil nil nil t)
331         (push article out))
332       (gnus-summary-remove-process-mark article)
333       (gnus-summary-update-secondary-mark article))
334     (gnus-summary-next-subject 1)
335     (gnus-summary-position-point)
336     (nreverse out)))
337
338 (defun gnus-cached-article-p (article)
339   "Say whether ARTICLE is cached in the current group."
340   (memq article gnus-newsgroup-cached))
341
342 (defun gnus-summary-insert-cached-articles ()
343   "Insert all the articles cached for this group into the current buffer."
344   (interactive)
345   (let ((cached gnus-newsgroup-cached))
346     (unless cached
347       (error "No cached articles for this group"))
348     (while cached
349       (gnus-summary-goto-subject (pop cached) t))))
350
351 ;;; Internal functions.
352
353 (defun gnus-cache-change-buffer (group)
354   (and gnus-cache-buffer
355        ;; See if the current group's overview cache has been loaded.
356        (or (string= group (car gnus-cache-buffer))
357            ;; Another overview cache is current, save it.
358            (gnus-cache-save-buffers)))
359   ;; if gnus-cache buffer is nil, create it
360   (unless gnus-cache-buffer
361     ;; Create cache buffer
362     (save-excursion
363       (setq gnus-cache-buffer
364             (cons group
365                   (set-buffer (get-buffer-create " *gnus-cache-overview*"))))
366       (buffer-disable-undo (current-buffer))
367       ;; Insert the contents of this group's cache overview.
368       (erase-buffer)
369       (let ((file (gnus-cache-file-name group ".overview")))
370         (when (file-exists-p file)
371           (insert-file-contents file)))
372       ;; We have a fresh (empty/just loaded) buffer, 
373       ;; mark it as unmodified to save a redundant write later.
374       (set-buffer-modified-p nil))))
375
376 ;; Return whether an article is a member of a class.
377 (defun gnus-cache-member-of-class (class ticked dormant unread)
378   (or (and ticked (memq 'ticked class))
379       (and dormant (memq 'dormant class))
380       (and unread (memq 'unread class))
381       (and (not unread) (not ticked) (not dormant) (memq 'read class))))
382
383 (defun gnus-cache-file-name (group article)
384   (concat (file-name-as-directory gnus-cache-directory)
385           (file-name-as-directory
386            (if (gnus-use-long-file-name 'not-cache)
387                group 
388              (let ((group (nnheader-replace-chars-in-string group ?/ ?_)))
389                ;; Translate the first colon into a slash.
390                (when (string-match ":" group)
391                  (aset group (match-beginning 0) ?/))
392                (nnheader-replace-chars-in-string group ?. ?/))))
393           (if (stringp article) article (int-to-string article))))
394
395 (defun gnus-cache-update-article (group article)
396   "If ARTICLE is in the cache, remove it and re-enter it."
397   (when (gnus-cache-possibly-remove-article article nil nil nil t)
398     (let ((gnus-use-cache nil))
399       (gnus-cache-possibly-enter-article 
400        gnus-newsgroup-name article (gnus-summary-article-header article)
401        nil nil nil t))))
402
403 (defun gnus-cache-possibly-remove-article (article ticked dormant unread 
404                                                    &optional force)
405   "Possibly remove ARTICLE from the cache."
406   (let ((group gnus-newsgroup-name)
407         (number article)
408         file)
409     ;; If this is a virtual group, we find the real group.
410     (when (gnus-virtual-group-p group)
411       (let ((result (nnvirtual-find-group-art 
412                      (gnus-group-real-name group) article)))
413         (setq group (car result)
414               number (cdr result))))
415     (setq file (gnus-cache-file-name group number))
416     (when (and (file-exists-p file)
417                (or force
418                    (gnus-cache-member-of-class
419                     gnus-cache-remove-articles ticked dormant unread)))
420       (save-excursion
421         (delete-file file)
422         (set-buffer (cdr gnus-cache-buffer))
423         (goto-char (point-min))
424         (when (or (looking-at (concat (int-to-string number) "\t"))
425                   (search-forward (concat "\n" (int-to-string number) "\t")
426                                   (point-max) t))
427           (delete-region (progn (beginning-of-line) (point))
428                          (progn (forward-line 1) (point)))))
429       (setq gnus-newsgroup-cached
430             (delq article gnus-newsgroup-cached))
431       (gnus-summary-update-secondary-mark article)
432       t)))
433
434 (defun gnus-cache-articles-in-group (group)
435   "Return a sorted list of cached articles in GROUP."
436   (let ((dir (file-name-directory (gnus-cache-file-name group 1))))
437     (when (file-exists-p dir)
438       (sort (mapcar (lambda (name) (string-to-int name))
439                     (directory-files dir nil "^[0-9]+$" t))
440             '<))))
441
442 (defun gnus-cache-braid-nov (group cached)
443   (let ((cache-buf (get-buffer-create " *gnus-cache*"))
444         beg end)
445     (gnus-cache-save-buffers)
446     (save-excursion
447       (set-buffer cache-buf)
448       (buffer-disable-undo (current-buffer))
449       (erase-buffer)
450       (insert-file-contents (gnus-cache-file-name group ".overview"))
451       (goto-char (point-min))
452       (insert "\n")
453       (goto-char (point-min)))
454     (set-buffer nntp-server-buffer)
455     (goto-char (point-min))
456     (while cached
457       (while (and (not (eobp))
458                   (< (read (current-buffer)) (car cached)))
459         (forward-line 1))
460       (beginning-of-line)
461       (save-excursion
462         (set-buffer cache-buf)
463         (if (search-forward (concat "\n" (int-to-string (car cached)) "\t")
464                             nil t)
465             (setq beg (progn (beginning-of-line) (point))
466                   end (progn (end-of-line) (point)))
467           (setq beg nil)))
468       (when beg
469         (insert-buffer-substring cache-buf beg end)
470         (insert "\n"))
471       (setq cached (cdr cached)))
472     (kill-buffer cache-buf)))
473
474 (defun gnus-cache-braid-heads (group cached)
475   (let ((cache-buf (get-buffer-create " *gnus-cache*")))
476     (save-excursion
477       (set-buffer cache-buf)
478       (buffer-disable-undo (current-buffer))
479       (erase-buffer))
480     (set-buffer nntp-server-buffer)
481     (goto-char (point-min))
482     (while cached
483       (while (and (not (eobp))
484                   (looking-at "2.. +\\([0-9]+\\) ")
485                   (< (progn (goto-char (match-beginning 1))
486                             (read (current-buffer)))
487                      (car cached)))
488         (search-forward "\n.\n" nil 'move))
489       (beginning-of-line)
490       (save-excursion
491         (set-buffer cache-buf)
492         (erase-buffer)
493         (insert-file-contents (gnus-cache-file-name group (car cached)))
494         (goto-char (point-min))
495         (insert "220 ")
496         (princ (car cached) (current-buffer))
497         (insert " Article retrieved.\n")
498         (search-forward "\n\n" nil 'move)
499         (delete-region (point) (point-max))
500         (forward-char -1)
501         (insert "."))
502       (insert-buffer-substring cache-buf)
503       (setq cached (cdr cached)))
504     (kill-buffer cache-buf)))
505
506 ;;;###autoload
507 (defun gnus-jog-cache ()
508   "Go through all groups and put the articles into the cache.
509
510 Usage:
511 $ emacs -batch -l ~/.emacs -l gnus -f gnus-jog-cache"
512   (interactive)
513   (let ((gnus-mark-article-hook nil)
514         (gnus-expert-user t)
515         (nnmail-spool-file nil)
516         (gnus-use-dribble-file nil)
517         (gnus-novice-user nil)
518         (gnus-large-newsgroup nil))
519     ;; Start Gnus.
520     (gnus)
521     ;; Go through all groups...
522     (gnus-group-mark-buffer)
523     (gnus-group-universal-argument 
524      nil nil 
525      (lambda ()
526        (gnus-summary-read-group (gnus-group-group-name) nil t)
527        ;; ... and enter the articles into the cache.
528        (when (eq major-mode 'gnus-summary-mode)
529          (gnus-uu-mark-buffer)
530          (gnus-cache-enter-article)
531          (kill-buffer (current-buffer)))))))
532
533 (defun gnus-cache-read-active (&optional force)
534   "Read the cache active file."
535   (gnus-make-directory gnus-cache-directory)
536   (if (not (and (file-exists-p gnus-cache-active-file)
537                 (or force (not gnus-cache-active-hashtb))))
538       ;; There is no active file, so we generate one.
539       (gnus-cache-generate-active)
540     ;; We simply read the active file.
541     (save-excursion
542       (gnus-set-work-buffer)
543       (insert-file-contents gnus-cache-active-file)
544       (gnus-active-to-gnus-format
545        nil (setq gnus-cache-active-hashtb 
546                  (gnus-make-hashtable 
547                   (count-lines (point-min) (point-max)))))
548       (setq gnus-cache-active-altered nil))))
549        
550 (defun gnus-cache-write-active (&optional force)
551   "Write the active hashtb to the active file."
552   (when (or force
553             (and gnus-cache-active-hashtb
554                  gnus-cache-active-altered))
555     (nnheader-temp-write gnus-cache-active-file
556       (mapatoms
557        (lambda (sym)
558          (when (and sym (boundp sym))
559            (insert (format "%s %d %d y\n"
560                            (symbol-name sym) (cdr (symbol-value sym))
561                            (car (symbol-value sym))))))
562        gnus-cache-active-hashtb))
563     ;; Mark the active hashtb as unaltered.
564     (setq gnus-cache-active-altered nil)))
565
566 (defun gnus-cache-update-active (group number &optional low)
567   "Update the upper bound of the active info of GROUP to NUMBER.
568 If LOW, update the lower bound instead."
569   (let ((active (gnus-gethash group gnus-cache-active-hashtb)))
570     (if (null active)
571         ;; We just create a new active entry for this group.
572         (gnus-sethash group (cons number number) gnus-cache-active-hashtb)
573       ;; Update the lower or upper bound.
574       (if low
575           (setcar active number)
576         (setcdr active number))
577       ;; Mark the active hashtb as altered.
578       (setq gnus-cache-active-altered t))))
579
580 ;;;###autoload
581 (defun gnus-cache-generate-active (&optional directory)
582   "Generate the cache active file."
583   (interactive)
584   (let* ((top (null directory))
585          (directory (expand-file-name (or directory gnus-cache-directory)))
586          (files (directory-files directory 'full))
587          (group 
588           (if top
589               ""
590             (string-match 
591              (concat "^" (file-name-as-directory
592                           (expand-file-name gnus-cache-directory)))
593              (directory-file-name directory))
594             (nnheader-replace-chars-in-string 
595              (substring (directory-file-name directory) (match-end 0))
596              ?/ ?.)))
597          nums alphs)
598     (when top
599       (gnus-message 5 "Generating the cache active file...")
600       (setq gnus-cache-active-hashtb (gnus-make-hashtable 123)))
601     ;; Separate articles from all other files and directories.
602     (while files
603       (if (string-match "^[0-9]+$" (file-name-nondirectory (car files)))
604           (push (string-to-int (file-name-nondirectory (pop files))) nums)
605         (push (pop files) alphs)))
606     ;; If we have nums, then this is probably a valid group.
607     (when (setq nums (sort nums '<))
608       (gnus-sethash group (cons (car nums) (gnus-last-element nums))
609                     gnus-cache-active-hashtb))
610     ;; Go through all the other files.
611     (while alphs
612       (when (and (file-directory-p (car alphs))
613                  (not (string-match "^\\.\\.?$"
614                                     (file-name-nondirectory (car alphs)))))
615         ;; We descend directories.
616         (gnus-cache-generate-active (car alphs)))
617       (setq alphs (cdr alphs)))
618     ;; Write the new active file.
619     (when top
620       (gnus-cache-write-active t)
621       (gnus-message 5 "Generating the cache active file...done"))))
622
623 ;;;###autoload
624 (defun gnus-cache-generate-nov-databases (dir)
625   "Generate NOV files recursively starting in DIR."
626   (interactive (list gnus-cache-directory))
627   (gnus-cache-close)
628   (let ((nnml-generate-active-function 'identity))
629     (nnml-generate-nov-databases-1 dir)))
630
631 (provide 'gnus-cache)
632               
633 ;;; gnus-cache.el ends here