annotate lisp/gnus/gnus-cache.el @ 0:376386a54a3c r19-14

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