1 ;;; gnus-cache.el --- cache interface for Gnus
2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
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.
29 (eval-when-compile (require 'cl
))
36 (if (not (fboundp 'gnus-agent-load-alist
))
37 (defun gnus-agent-load-alist (group)))
40 (defcustom gnus-cache-active-file
41 (expand-file-name "active" gnus-cache-directory
)
42 "*The cache active file."
46 (defcustom gnus-cache-enter-articles
'(ticked dormant
)
47 "Classes of articles to enter into the cache."
49 :type
'(set (const ticked
) (const dormant
) (const unread
) (const read
)))
51 (defcustom gnus-cache-remove-articles
'(read)
52 "Classes of articles to remove from the cache."
54 :type
'(set (const ticked
) (const dormant
) (const unread
) (const read
)))
56 (defcustom gnus-cacheable-groups nil
57 "*Groups that match this regexp will be cached.
59 If you only want to cache your nntp groups, you could set this
60 variable to \"^nntp\".
62 If a group matches both gnus-cacheable-groups and gnus-uncacheable-groups
65 :type
'(choice (const :tag
"off" nil
)
68 (defcustom gnus-uncacheable-groups nil
69 "*Groups that match this regexp will not be cached.
71 If you want to avoid caching your nnml groups, you could set this
72 variable to \"^nnml\".
74 If a group matches both gnus-cacheable-groups and gnus-uncacheable-groups
77 :type
'(choice (const :tag
"off" nil
)
80 (defvar gnus-cache-overview-coding-system
'raw-text
81 "Coding system used on Gnus cache files.")
83 (defvar gnus-cache-coding-system
'raw-text
84 "Coding system used on Gnus cache files.")
88 ;;; Internal variables.
90 (defvar gnus-cache-removable-articles nil
)
91 (defvar gnus-cache-buffer nil
)
92 (defvar gnus-cache-active-hashtb nil
)
93 (defvar gnus-cache-active-altered nil
)
96 (autoload 'nnml-generate-nov-databases-1
"nnml")
97 (autoload 'nnvirtual-find-group-art
"nnvirtual"))
101 ;;; Functions called from Gnus.
103 (defun gnus-cache-open ()
104 "Initialize the cache."
105 (when (or (file-exists-p gnus-cache-directory
)
107 (not (eq gnus-use-cache
'passive
))))
108 (gnus-cache-read-active)))
110 ;; Complexities of byte-compiling make this kludge necessary. Eeek.
112 (gnus-add-shutdown 'gnus-cache-close
'gnus
))
114 (defun gnus-cache-close ()
115 "Shut down the cache."
116 (gnus-cache-write-active)
117 (gnus-cache-save-buffers)
118 (setq gnus-cache-active-hashtb nil
))
120 (defun gnus-cache-save-buffers ()
121 ;; save the overview buffer if it exists and has been modified
122 ;; delete empty cache subdirectories
123 (when gnus-cache-buffer
124 (let ((buffer (cdr gnus-cache-buffer
))
125 (overview-file (gnus-cache-file-name
126 (car gnus-cache-buffer
) ".overview")))
127 ;; write the overview only if it was modified
128 (when (buffer-modified-p buffer
)
131 (if (> (buffer-size) 0)
132 ;; Non-empty overview, write it to a file.
133 (let ((coding-system-for-write
134 gnus-cache-overview-coding-system
))
135 (gnus-write-buffer overview-file
))
136 ;; Empty overview file, remove it
137 (when (file-exists-p overview-file
)
138 (delete-file overview-file
))
139 ;; If possible, remove group's cache subdirectory.
141 ;; FIXME: we can detect the error type and warn the user
142 ;; of any inconsistencies (articles w/o nov entries?).
143 ;; for now, just be conservative...delete only if safe -- sj
144 (delete-directory (file-name-directory overview-file
))
146 ;; Kill the buffer -- it's either unmodified or saved.
147 (gnus-kill-buffer buffer
)
148 (setq gnus-cache-buffer nil
))))
150 (defun gnus-cache-possibly-enter-article
151 (group article ticked dormant unread
&optional force
)
152 (when (and (or force
(not (eq gnus-use-cache
'passive
)))
154 (> article
0)) ; This might be a dummy article.
155 (let ((number article
) file headers
)
156 ;; If this is a virtual group, we find the real group.
157 (when (gnus-virtual-group-p group
)
158 (let ((result (nnvirtual-find-group-art
159 (gnus-group-real-name group
) article
)))
160 (setq group
(car result
)
161 number
(cdr result
))))
163 (> number
0) ; Reffed article.
165 (and (gnus-cache-fully-p group
)
166 (gnus-cache-member-of-class
167 gnus-cache-enter-articles ticked dormant unread
)))
168 (not (file-exists-p (setq file
(gnus-cache-file-name
170 ;; Possibly create the cache directory.
171 (gnus-make-directory (file-name-directory file
))
172 ;; Save the article in the cache.
173 (if (file-exists-p file
)
174 t
; The article already is saved.
176 (set-buffer nntp-server-buffer
)
178 (let ((gnus-use-cache nil
)
179 (gnus-article-decode-hook nil
))
180 (gnus-request-article-this-buffer number group
))
181 (when (> (buffer-size) 0)
182 (let ((coding-system-for-write gnus-cache-coding-system
))
183 (gnus-write-buffer file
))
184 (nnheader-remove-body)
185 (setq headers
(nnheader-parse-naked-head))
186 (mail-header-set-number headers number
)
187 (gnus-cache-change-buffer group
)
188 (set-buffer (cdr gnus-cache-buffer
))
189 (goto-char (point-max))
191 (while (condition-case ()
193 (> (read (current-buffer)) number
))
195 ;; The line was malformed, so we just remove it!!
203 (when (< (read (current-buffer)) number
)
208 (nnheader-insert-nov headers
)
209 ;; Update the active info.
210 (set-buffer gnus-summary-buffer
)
211 (gnus-cache-possibly-update-active group
(cons number number
))
212 (setq gnus-newsgroup-cached
213 (gnus-add-to-sorted-list gnus-newsgroup-cached article
))
214 (gnus-summary-update-secondary-mark article
))
217 (defun gnus-cache-enter-remove-article (article)
218 "Mark ARTICLE for later possible removal."
220 (push article gnus-cache-removable-articles
)))
222 (defun gnus-cache-possibly-remove-articles ()
223 "Possibly remove some of the removable articles."
224 (if (not (gnus-virtual-group-p gnus-newsgroup-name
))
225 (gnus-cache-possibly-remove-articles-1)
226 (let ((arts gnus-cache-removable-articles
)
229 (when (setq ga
(nnvirtual-find-group-art
230 (gnus-group-real-name gnus-newsgroup-name
) (pop arts
)))
231 (let ((gnus-cache-removable-articles (list (cdr ga
)))
232 (gnus-newsgroup-name (car ga
)))
233 (gnus-cache-possibly-remove-articles-1)))))
234 (setq gnus-cache-removable-articles nil
)))
236 (defun gnus-cache-possibly-remove-articles-1 ()
237 "Possibly remove some of the removable articles."
238 (when (gnus-cache-fully-p gnus-newsgroup-name
)
239 (let ((articles gnus-cache-removable-articles
)
240 (cache-articles gnus-newsgroup-cached
)
242 (gnus-cache-change-buffer gnus-newsgroup-name
)
244 (when (memq (setq article
(pop articles
)) cache-articles
)
245 ;; The article was in the cache, so we see whether we are
246 ;; supposed to remove it from the cache.
247 (gnus-cache-possibly-remove-article
248 article
(memq article gnus-newsgroup-marked
)
249 (memq article gnus-newsgroup-dormant
)
250 (or (memq article gnus-newsgroup-unreads
)
251 (memq article gnus-newsgroup-unselected
))))))
252 ;; The overview file might have been modified, save it
253 ;; safe because we're only called at group exit anyway.
254 (gnus-cache-save-buffers)))
256 (defun gnus-cache-request-article (article group
)
257 "Retrieve ARTICLE in GROUP from the cache."
258 (let ((file (gnus-cache-file-name group article
))
259 (buffer-read-only nil
))
260 (when (file-exists-p file
)
262 (gnus-kill-all-overlays)
263 (let ((coding-system-for-read gnus-cache-coding-system
))
264 (insert-file-contents file
))
267 (defun gnus-cache-possibly-alter-active (group active
)
268 "Alter the ACTIVE info for GROUP to reflect the articles in the cache."
269 (when gnus-cache-active-hashtb
270 (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb
)))
272 (when (< (car cache-active
) (car active
))
273 (setcar active
(car cache-active
)))
274 (when (> (cdr cache-active
) (cdr active
))
275 (setcdr active
(cdr cache-active
)))))))
277 (defun gnus-cache-retrieve-headers (articles group
&optional fetch-old
)
278 "Retrieve the headers for ARTICLES in GROUP."
280 (setq gnus-newsgroup-cached
(gnus-cache-articles-in-group group
))))
282 ;; No cached articles here, so we just retrieve them
284 (let ((gnus-use-cache nil
))
285 (gnus-retrieve-headers articles group fetch-old
))
286 (let ((uncached-articles (gnus-sorted-difference articles cached
))
287 (cache-file (gnus-cache-file-name group
".overview"))
289 ;; We first retrieve all the headers that we don't have in
291 (let ((gnus-use-cache nil
))
292 (when uncached-articles
293 (setq type
(and articles
294 (gnus-retrieve-headers
295 uncached-articles group fetch-old
)))))
296 (gnus-cache-save-buffers)
297 ;; Then we insert the cached headers.
300 ((not (file-exists-p cache-file
))
301 ;; There are no cached headers.
304 ;; There were no uncached headers (or retrieval was
305 ;; unsuccessful), so we use the cached headers exclusively.
306 (set-buffer nntp-server-buffer
)
308 (let ((coding-system-for-read
309 gnus-cache-overview-coding-system
))
310 (insert-file-contents cache-file
))
313 ;; We have both cached and uncached NOV headers, so we
315 (gnus-cache-braid-nov group cached
)
319 (gnus-cache-braid-heads group
(gnus-sorted-intersection
323 (defun gnus-cache-enter-article (&optional n
)
324 "Enter the next N articles into the cache.
325 If not given a prefix, use the process marked articles instead.
326 Returns the list of articles entered."
328 (let ((articles (gnus-summary-work-articles n
))
330 (while (setq article
(pop articles
))
331 (gnus-summary-remove-process-mark article
)
332 (if (natnump article
)
333 (when (gnus-cache-possibly-enter-article
334 gnus-newsgroup-name article
336 (setq gnus-newsgroup-undownloaded
(delq article gnus-newsgroup-undownloaded
))
338 (gnus-message 2 "Can't cache article %d" article
))
339 (gnus-summary-update-download-mark article
)
340 (gnus-summary-update-secondary-mark article
))
341 (gnus-summary-next-subject 1)
342 (gnus-summary-position-point)
345 (defun gnus-cache-remove-article (&optional n
)
346 "Remove the next N articles from the cache.
347 If not given a prefix, use the process marked articles instead.
348 Returns the list of articles removed."
350 (gnus-cache-change-buffer gnus-newsgroup-name
)
351 (let ((articles (gnus-summary-work-articles n
))
354 (setq article
(pop articles
))
355 (gnus-summary-remove-process-mark article
)
356 (when (gnus-cache-possibly-remove-article article nil nil nil t
)
357 (when gnus-newsgroup-agentized
358 (let ((alist (gnus-agent-load-alist gnus-newsgroup-name
)))
359 (unless (cdr (assoc article alist
))
360 (setq gnus-newsgroup-undownloaded
361 (gnus-add-to-sorted-list
362 gnus-newsgroup-undownloaded article
)))))
364 (gnus-summary-update-download-mark article
)
365 (gnus-summary-update-secondary-mark article
))
366 (gnus-summary-next-subject 1)
367 (gnus-summary-position-point)
370 (defun gnus-cached-article-p (article)
371 "Say whether ARTICLE is cached in the current group."
372 (memq article gnus-newsgroup-cached
))
374 (defun gnus-summary-insert-cached-articles ()
375 "Insert all the articles cached for this group into the current buffer."
377 (let ((gnus-verbose (max 6 gnus-verbose
)))
378 (if (not gnus-newsgroup-cached
)
379 (gnus-message 3 "No cached articles for this group")
380 (gnus-summary-goto-subjects gnus-newsgroup-cached
))))
382 (defun gnus-summary-limit-include-cached ()
383 "Limit the summary buffer to articles that are cached."
385 (let ((gnus-verbose (max 6 gnus-verbose
)))
386 (if gnus-newsgroup-cached
388 (gnus-summary-limit gnus-newsgroup-cached
)
389 (gnus-summary-position-point))
390 (gnus-message 3 "No cached articles for this group"))))
392 ;;; Internal functions.
394 (defun gnus-cache-change-buffer (group)
395 (and gnus-cache-buffer
396 ;; See if the current group's overview cache has been loaded.
397 (or (string= group
(car gnus-cache-buffer
))
398 ;; Another overview cache is current, save it.
399 (gnus-cache-save-buffers)))
400 ;; if gnus-cache buffer is nil, create it
401 (unless gnus-cache-buffer
402 ;; Create cache buffer
404 (setq gnus-cache-buffer
406 (set-buffer (gnus-get-buffer-create
407 " *gnus-cache-overview*"))))
408 ;; Insert the contents of this group's cache overview.
410 (let ((file (gnus-cache-file-name group
".overview")))
411 (when (file-exists-p file
)
412 (nnheader-insert-file-contents file
)))
413 ;; We have a fresh (empty/just loaded) buffer,
414 ;; mark it as unmodified to save a redundant write later.
415 (set-buffer-modified-p nil
))))
417 ;; Return whether an article is a member of a class.
418 (defun gnus-cache-member-of-class (class ticked dormant unread
)
419 (or (and ticked
(memq 'ticked class
))
420 (and dormant
(memq 'dormant class
))
421 (and unread
(memq 'unread class
))
422 (and (not unread
) (not ticked
) (not dormant
) (memq 'read class
))))
424 (defun gnus-cache-file-name (group article
)
426 (if (stringp article
) article
(int-to-string article
))
427 (file-name-as-directory
429 (nnheader-translate-file-chars
430 (if (gnus-use-long-file-name 'not-cache
)
432 (let ((group (nnheader-replace-duplicate-chars-in-string
433 (nnheader-replace-chars-in-string group ?
/ ?_
)
435 ;; Translate the first colon into a slash.
436 (when (string-match ":" group
)
437 (setq group
(concat (substring group
0 (match-beginning 0))
438 "/" (substring group
(match-end 0)))))
439 (nnheader-replace-chars-in-string group ?. ?
/)))
441 gnus-cache-directory
))))
443 (defun gnus-cache-update-article (group article
)
444 "If ARTICLE is in the cache, remove it and re-enter it."
445 (gnus-cache-change-buffer group
)
446 (when (gnus-cache-possibly-remove-article article nil nil nil t
)
447 (let ((gnus-use-cache nil
))
448 (gnus-cache-possibly-enter-article
449 gnus-newsgroup-name article
452 (defun gnus-cache-possibly-remove-article (article ticked dormant unread
454 "Possibly remove ARTICLE from the cache."
455 (let ((group gnus-newsgroup-name
)
458 ;; If this is a virtual group, we find the real group.
459 (when (gnus-virtual-group-p group
)
460 (let ((result (nnvirtual-find-group-art
461 (gnus-group-real-name group
) article
)))
462 (setq group
(car result
)
463 number
(cdr result
))))
464 (setq file
(gnus-cache-file-name group number
))
465 (when (and (file-exists-p file
)
467 (gnus-cache-member-of-class
468 gnus-cache-remove-articles ticked dormant unread
)))
471 (set-buffer (cdr gnus-cache-buffer
))
472 (goto-char (point-min))
473 (when (or (looking-at (concat (int-to-string number
) "\t"))
474 (search-forward (concat "\n" (int-to-string number
) "\t")
477 (unless (setq gnus-newsgroup-cached
478 (delq article gnus-newsgroup-cached
))
479 (gnus-sethash gnus-newsgroup-name nil gnus-cache-active-hashtb
)
480 (setq gnus-cache-active-altered t
))
481 (gnus-summary-update-secondary-mark article
)
484 (defun gnus-cache-articles-in-group (group)
485 "Return a sorted list of cached articles in GROUP."
486 (let ((dir (file-name-directory (gnus-cache-file-name group
1)))
488 (when (file-exists-p dir
)
490 (sort (mapcar (lambda (name) (string-to-int name
))
491 (directory-files dir nil
"^[0-9]+$" t
))
493 ;; Update the cache active file, just to synch more.
496 (gnus-cache-update-active group
(car articles
) t
)
497 (gnus-cache-update-active group
(car (last articles
))))
498 (when (gnus-gethash group gnus-cache-active-hashtb
)
499 (gnus-sethash group nil gnus-cache-active-hashtb
)
500 (setq gnus-cache-active-altered t
)))
503 (defun gnus-cache-braid-nov (group cached
&optional file
)
504 (let ((cache-buf (gnus-get-buffer-create " *gnus-cache*"))
506 (gnus-cache-save-buffers)
508 (set-buffer cache-buf
)
510 (let ((coding-system-for-read
511 gnus-cache-overview-coding-system
))
512 (insert-file-contents
513 (or file
(gnus-cache-file-name group
".overview"))))
514 (goto-char (point-min))
516 (goto-char (point-min)))
517 (set-buffer nntp-server-buffer
)
518 (goto-char (point-min))
520 (while (and (not (eobp))
521 (< (read (current-buffer)) (car cached
)))
524 (set-buffer cache-buf
)
525 (if (search-forward (concat "\n" (int-to-string (car cached
)) "\t")
527 (setq beg
(gnus-point-at-bol)
528 end
(progn (end-of-line) (point)))
530 (set-buffer nntp-server-buffer
)
532 (insert-buffer-substring cache-buf beg end
)
534 (setq cached
(cdr cached
)))
535 (kill-buffer cache-buf
)))
537 (defun gnus-cache-braid-heads (group cached
)
538 (let ((cache-buf (gnus-get-buffer-create " *gnus-cache*")))
540 (set-buffer cache-buf
)
542 (set-buffer nntp-server-buffer
)
543 (goto-char (point-min))
545 (while (and (not (eobp))
546 (looking-at "2.. +\\([0-9]+\\) ")
547 (< (progn (goto-char (match-beginning 1))
548 (read (current-buffer)))
550 (search-forward "\n.\n" nil
'move
))
552 (set-buffer cache-buf
)
554 (let ((coding-system-for-read
555 gnus-cache-coding-system
))
556 (insert-file-contents (gnus-cache-file-name group
(car cached
))))
557 (goto-char (point-min))
559 (princ (car cached
) (current-buffer))
560 (insert " Article retrieved.\n")
561 (search-forward "\n\n" nil
'move
)
562 (delete-region (point) (point-max))
565 (set-buffer nntp-server-buffer
)
566 (insert-buffer-substring cache-buf
)
567 (setq cached
(cdr cached
)))
568 (kill-buffer cache-buf
)))
571 (defun gnus-jog-cache ()
572 "Go through all groups and put the articles into the cache.
575 $ emacs -batch -l ~/.emacs -l gnus -f gnus-jog-cache"
577 (let ((gnus-mark-article-hook nil
)
579 (nnmail-spool-file nil
)
581 (gnus-use-dribble-file nil
)
582 (gnus-novice-user nil
)
583 (gnus-large-newsgroup nil
))
586 ;; Go through all groups...
587 (gnus-group-mark-buffer)
588 (gnus-group-iterate nil
590 (let (gnus-auto-select-next)
591 (gnus-summary-read-group group nil t
)
592 ;; ... and enter the articles into the cache.
593 (when (eq major-mode
'gnus-summary-mode
)
594 (gnus-uu-mark-buffer)
595 (gnus-cache-enter-article)
596 (kill-buffer (current-buffer))))))))
598 (defun gnus-cache-read-active (&optional force
)
599 "Read the cache active file."
600 (gnus-make-directory gnus-cache-directory
)
601 (if (or (not (file-exists-p gnus-cache-active-file
))
602 (zerop (nth 7 (file-attributes gnus-cache-active-file
)))
604 ;; There is no active file, so we generate one.
605 (gnus-cache-generate-active)
606 ;; We simply read the active file.
608 (gnus-set-work-buffer)
609 (nnheader-insert-file-contents gnus-cache-active-file
)
610 (gnus-active-to-gnus-format
611 nil
(setq gnus-cache-active-hashtb
613 (count-lines (point-min) (point-max)))))
614 (setq gnus-cache-active-altered nil
))))
616 (defun gnus-cache-write-active (&optional force
)
617 "Write the active hashtb to the active file."
619 (and gnus-cache-active-hashtb
620 gnus-cache-active-altered
))
621 (gnus-write-active-file gnus-cache-active-file gnus-cache-active-hashtb t
)
622 ;; Mark the active hashtb as unaltered.
623 (setq gnus-cache-active-altered nil
)))
625 (defun gnus-cache-possibly-update-active (group active
)
626 "Update active info bounds of GROUP with ACTIVE if necessary.
627 The update is performed if ACTIVE contains a higher or lower bound
629 (let ((lower t
) (higher t
))
630 (if gnus-cache-active-hashtb
631 (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb
)))
633 (unless (< (car active
) (car cache-active
))
635 (unless (> (cdr active
) (cdr cache-active
))
637 (gnus-cache-read-active))
639 (gnus-cache-update-active group
(car active
) t
))
641 (gnus-cache-update-active group
(cdr active
)))))
643 (defun gnus-cache-update-active (group number
&optional low
)
644 "Update the upper bound of the active info of GROUP to NUMBER.
645 If LOW, update the lower bound instead."
646 (let ((active (gnus-gethash group gnus-cache-active-hashtb
)))
648 ;; We just create a new active entry for this group.
649 (gnus-sethash group
(cons number number
) gnus-cache-active-hashtb
)
650 ;; Update the lower or upper bound.
652 (setcar active number
)
653 (setcdr active number
)))
654 ;; Mark the active hashtb as altered.
655 (setq gnus-cache-active-altered t
)))
658 (defun gnus-cache-generate-active (&optional directory
)
659 "Generate the cache active file."
661 (let* ((top (null directory
))
662 (directory (expand-file-name (or directory gnus-cache-directory
)))
663 (files (directory-files directory
'full
))
668 (concat "^" (regexp-quote
669 (file-name-as-directory
670 (expand-file-name gnus-cache-directory
))))
671 (directory-file-name directory
))
672 (nnheader-replace-chars-in-string
673 (substring (directory-file-name directory
) (match-end 0))
677 (gnus-message 5 "Generating the cache active file...")
678 (setq gnus-cache-active-hashtb
(gnus-make-hashtable 123)))
679 (when (string-match "^\\(nn[^_]+\\)_" group
)
680 (setq group
(replace-match "\\1:" t nil group
)))
681 ;; Separate articles from all other files and directories.
683 (if (string-match "^[0-9]+$" (file-name-nondirectory (car files
)))
684 (push (string-to-int (file-name-nondirectory (pop files
))) nums
)
685 (push (pop files
) alphs
)))
686 ;; If we have nums, then this is probably a valid group.
687 (when (setq nums
(sort nums
'<))
688 (gnus-sethash group
(cons (car nums
) (gnus-last-element nums
))
689 gnus-cache-active-hashtb
))
690 ;; Go through all the other files.
692 (when (and (file-directory-p (car alphs
))
693 (not (string-match "^\\."
694 (file-name-nondirectory (car alphs
)))))
695 ;; We descend directories.
696 (gnus-cache-generate-active (car alphs
)))
697 (setq alphs
(cdr alphs
)))
698 ;; Write the new active file.
700 (gnus-cache-write-active t
)
701 (gnus-message 5 "Generating the cache active file...done"))))
704 (defun gnus-cache-generate-nov-databases (dir)
705 "Generate NOV files recursively starting in DIR."
706 (interactive (list gnus-cache-directory
))
708 (let ((nnml-generate-active-function 'identity
))
709 (nnml-generate-nov-databases-1 dir
))
712 (defun gnus-cache-move-cache (dir)
713 "Move the cache tree to somewhere else."
714 (interactive "FMove the cache tree to: ")
715 (rename-file gnus-cache-directory dir
))
717 (defun gnus-cache-fully-p (&optional group
)
718 "Returns non-nil if the cache should be fully used.
719 If GROUP is non-nil, also cater to `gnus-cacheable-groups' and
720 `gnus-uncacheable-groups'."
722 (not (eq gnus-use-cache
'passive
))
725 (and (or (not gnus-cacheable-groups
)
726 (string-match gnus-cacheable-groups group
))
727 (or (not gnus-uncacheable-groups
)
728 (not (string-match gnus-uncacheable-groups group
)))))))
730 (provide 'gnus-cache
)
732 ;;; arch-tag: 05a79442-8c58-4e65-bd0a-3cbb1b89a33a
733 ;;; gnus-cache.el ends here