Mercurial > emacs
annotate lisp/gnus/nnkiboze.el @ 33067:adc6c04ffe30
*** empty log message ***
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 30 Oct 2000 15:21:36 +0000 |
parents | 343a1c02c422 |
children | e06db3b8e558 |
rev | line source |
---|---|
17493 | 1 ;;; nnkiboze.el --- select virtual news access for Gnus |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2 |
32970
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
17493 | 5 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
32970
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
7 ;; Maintainer: bugs@gnus.org |
17493 | 8 ;; Keywords: news |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;; The other access methods (nntp, nnspool, etc) are general news | |
30 ;; access methods. This module relies on Gnus and can't be used | |
31 ;; separately. | |
32 | |
33 ;;; Code: | |
34 | |
35 (require 'nntp) | |
36 (require 'nnheader) | |
37 (require 'gnus) | |
38 (require 'gnus-score) | |
39 (require 'nnoo) | |
31785 | 40 (require 'mm-util) |
17493 | 41 (eval-when-compile (require 'cl)) |
42 | |
43 (nnoo-declare nnkiboze) | |
44 (defvoo nnkiboze-directory (nnheader-concat gnus-directory "kiboze/") | |
45 "nnkiboze will put its files in this directory.") | |
46 | |
47 (defvoo nnkiboze-level 9 | |
48 "The maximum level to be searched for articles.") | |
49 | |
50 (defvoo nnkiboze-remove-read-articles t | |
51 "If non-nil, nnkiboze will remove read articles from the kiboze group.") | |
52 | |
53 (defvoo nnkiboze-ephemeral nil | |
54 "If non-nil, don't store any data anywhere.") | |
55 | |
56 (defvoo nnkiboze-scores nil | |
57 "Score rules for generating the nnkiboze group.") | |
58 | |
59 (defvoo nnkiboze-regexp nil | |
60 "Regexp for matching component groups.") | |
61 | |
31785 | 62 (defvoo nnkiboze-file-coding-system mm-text-coding-system |
63 "Coding system for nnkiboze files.") | |
64 | |
17493 | 65 |
66 | |
67 (defconst nnkiboze-version "nnkiboze 1.0") | |
68 | |
69 (defvoo nnkiboze-current-group nil) | |
70 (defvoo nnkiboze-status-string "") | |
71 | |
72 (defvoo nnkiboze-headers nil) | |
73 | |
74 | |
75 | |
76 ;;; Interface functions. | |
77 | |
78 (nnoo-define-basics nnkiboze) | |
79 | |
80 (deffoo nnkiboze-retrieve-headers (articles &optional group server fetch-old) | |
81 (nnkiboze-possibly-change-group group) | |
82 (unless gnus-nov-is-evil | |
83 (if (stringp (car articles)) | |
84 'headers | |
85 (let ((nov (nnkiboze-nov-file-name))) | |
86 (when (file-exists-p nov) | |
87 (save-excursion | |
88 (set-buffer nntp-server-buffer) | |
89 (erase-buffer) | |
31785 | 90 (let ((nnheader-file-coding-system nnkiboze-file-coding-system)) |
91 (nnheader-insert-file-contents nov)) | |
17493 | 92 (nnheader-nov-delete-outside-range |
93 (car articles) (car (last articles))) | |
94 'nov)))))) | |
95 | |
96 (deffoo nnkiboze-request-article (article &optional newsgroup server buffer) | |
97 (nnkiboze-possibly-change-group newsgroup) | |
98 (if (not (numberp article)) | |
99 ;; This is a real kludge. It might not work at times, but it | |
100 ;; does no harm I think. The only alternative is to offer no | |
101 ;; article fetching by message-id at all. | |
102 (nntp-request-article article newsgroup gnus-nntp-server buffer) | |
103 (let* ((header (gnus-summary-article-header article)) | |
32970
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
104 (xref (mail-header-xref header)) |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
105 num group) |
17493 | 106 (unless xref |
107 (error "nnkiboze: No xref")) | |
108 (unless (string-match " \\([^ ]+\\):\\([0-9]+\\)" xref) | |
109 (error "nnkiboze: Malformed xref")) | |
32970
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
110 (setq num (string-to-int (match-string 2 xref)) |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
111 group (match-string 1 xref)) |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
112 (or (with-current-buffer buffer |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
113 (gnus-cache-request-article num group)) |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
114 (gnus-request-article num group buffer))))) |
17493 | 115 |
116 (deffoo nnkiboze-request-scan (&optional group server) | |
117 (nnkiboze-generate-group (concat "nnkiboze:" group))) | |
118 | |
119 (deffoo nnkiboze-request-group (group &optional server dont-check) | |
120 "Make GROUP the current newsgroup." | |
121 (nnkiboze-possibly-change-group group) | |
122 (if dont-check | |
123 t | |
124 (let ((nov-file (nnkiboze-nov-file-name)) | |
125 beg end total) | |
126 (save-excursion | |
127 (set-buffer nntp-server-buffer) | |
128 (erase-buffer) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
129 (unless (file-exists-p nov-file) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
130 (nnkiboze-request-scan group)) |
17493 | 131 (if (not (file-exists-p nov-file)) |
132 (nnheader-report 'nnkiboze "Can't select group %s" group) | |
31785 | 133 (let ((nnheader-file-coding-system nnkiboze-file-coding-system)) |
134 (nnheader-insert-file-contents nov-file)) | |
17493 | 135 (if (zerop (buffer-size)) |
136 (nnheader-insert "211 0 0 0 %s\n" group) | |
137 (goto-char (point-min)) | |
138 (when (looking-at "[0-9]+") | |
139 (setq beg (read (current-buffer)))) | |
140 (goto-char (point-max)) | |
141 (when (re-search-backward "^[0-9]" nil t) | |
142 (setq end (read (current-buffer)))) | |
143 (setq total (count-lines (point-min) (point-max))) | |
144 (nnheader-insert "211 %d %d %d %s\n" total beg end group))))))) | |
145 | |
146 (deffoo nnkiboze-close-group (group &optional server) | |
147 (nnkiboze-possibly-change-group group) | |
148 ;; Remove NOV lines of articles that are marked as read. | |
149 (when (and (file-exists-p (nnkiboze-nov-file-name)) | |
150 nnkiboze-remove-read-articles) | |
31785 | 151 (let ((coding-system-for-write nnkiboze-file-coding-system)) |
152 (with-temp-file (nnkiboze-nov-file-name) | |
153 (let ((cur (current-buffer)) | |
154 (nnheader-file-coding-system nnkiboze-file-coding-system)) | |
155 (nnheader-insert-file-contents (nnkiboze-nov-file-name)) | |
156 (goto-char (point-min)) | |
157 (while (not (eobp)) | |
158 (if (not (gnus-article-read-p (read cur))) | |
159 (forward-line 1) | |
160 (gnus-delete-line)))))) | |
161 (setq nnkiboze-current-group nil))) | |
17493 | 162 |
163 (deffoo nnkiboze-open-server (server &optional defs) | |
164 (unless (assq 'nnkiboze-regexp defs) | |
165 (push `(nnkiboze-regexp ,server) | |
166 defs)) | |
167 (nnoo-change-server 'nnkiboze server defs)) | |
168 | |
169 (deffoo nnkiboze-request-delete-group (group &optional force server) | |
170 (nnkiboze-possibly-change-group group) | |
171 (when force | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
172 (let ((files (nconc |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
173 (nnkiboze-score-file group) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
174 (list (nnkiboze-nov-file-name) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
175 (nnkiboze-nov-file-name ".newsrc"))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
176 (while files |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
177 (and (file-exists-p (car files)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
178 (file-writable-p (car files)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
179 (delete-file (car files))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
180 (setq files (cdr files))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
181 (setq nnkiboze-current-group nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
182 t) |
17493 | 183 |
184 (nnoo-define-skeleton nnkiboze) | |
185 | |
186 | |
187 ;;; Internal functions. | |
188 | |
189 (defun nnkiboze-possibly-change-group (group) | |
190 (setq nnkiboze-current-group group)) | |
191 | |
192 (defun nnkiboze-prefixed-name (group) | |
193 (gnus-group-prefixed-name group '(nnkiboze ""))) | |
194 | |
195 ;;;###autoload | |
196 (defun nnkiboze-generate-groups () | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
197 "\"Usage: emacs -batch -l nnkiboze -f nnkiboze-generate-groups\". |
17493 | 198 Finds out what articles are to be part of the nnkiboze groups." |
199 (interactive) | |
200 (let ((nnmail-spool-file nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
201 (mail-sources nil) |
17493 | 202 (gnus-use-dribble-file nil) |
203 (gnus-read-active-file t) | |
204 (gnus-expert-user t)) | |
205 (gnus)) | |
206 (let* ((gnus-newsrc-alist (gnus-copy-sequence gnus-newsrc-alist)) | |
207 (newsrc (cdr gnus-newsrc-alist)) | |
208 gnus-newsrc-hashtb info) | |
209 (gnus-make-hashtable-from-newsrc-alist) | |
210 ;; We have copied all the newsrc alist info over to local copies | |
211 ;; so that we can mess all we want with these lists. | |
212 (while (setq info (pop newsrc)) | |
213 (when (string-match "nnkiboze" (gnus-info-group info)) | |
214 ;; For each kiboze group, we call this function to generate | |
215 ;; it. | |
32970
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
216 (nnkiboze-generate-group (gnus-info-group info) t)))) |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
217 (save-excursion |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
218 (set-buffer gnus-group-buffer) |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
219 (gnus-group-list-groups))) |
17493 | 220 |
221 (defun nnkiboze-score-file (group) | |
222 (list (expand-file-name | |
223 (concat (file-name-as-directory gnus-kill-files-directory) | |
224 (nnheader-translate-file-chars | |
225 (concat (nnkiboze-prefixed-name nnkiboze-current-group) | |
226 "." gnus-score-file-suffix)))))) | |
227 | |
32970
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
228 (defun nnkiboze-generate-group (group &optional inhibit-list-groups) |
17493 | 229 (let* ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
230 (newsrc-file (concat nnkiboze-directory |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
231 (nnheader-translate-file-chars |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
232 (concat group ".newsrc")))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
233 (nov-file (concat nnkiboze-directory |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
234 (nnheader-translate-file-chars |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
235 (concat group ".nov")))) |
17493 | 236 method nnkiboze-newsrc gname newsrc active |
237 ginfo lowest glevel orig-info nov-buffer | |
238 ;; Bind various things to nil to make group entry faster. | |
239 (gnus-expert-user t) | |
240 (gnus-large-newsgroup nil) | |
241 (gnus-score-find-score-files-function 'nnkiboze-score-file) | |
32970
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
242 ;; Use only nnkiboze-score-file! |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
243 (gnus-score-use-all-scores nil) |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
244 (gnus-use-scoring t) |
17493 | 245 (gnus-verbose (min gnus-verbose 3)) |
246 gnus-select-group-hook gnus-summary-prepare-hook | |
247 gnus-thread-sort-functions gnus-show-threads | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
248 gnus-visual gnus-suppress-duplicates num-unread) |
17493 | 249 (unless info |
250 (error "No such group: %s" group)) | |
251 ;; Load the kiboze newsrc file for this group. | |
252 (when (file-exists-p newsrc-file) | |
253 (load newsrc-file)) | |
31785 | 254 (let ((coding-system-for-write nnkiboze-file-coding-system)) |
255 (with-temp-file nov-file | |
256 (when (file-exists-p nov-file) | |
257 (insert-file-contents nov-file)) | |
258 (setq nov-buffer (current-buffer)) | |
259 ;; Go through the active hashtb and add new all groups that match the | |
260 ;; kiboze regexp. | |
261 (mapatoms | |
262 (lambda (group) | |
263 (and (string-match nnkiboze-regexp | |
264 (setq gname (symbol-name group))) ; Match | |
265 (not (assoc gname nnkiboze-newsrc)) ; It isn't registered | |
266 (numberp (car (symbol-value group))) ; It is active | |
267 (or (> nnkiboze-level 7) | |
268 (and (setq glevel (nth 1 (nth 2 (gnus-gethash | |
269 gname gnus-newsrc-hashtb)))) | |
270 (>= nnkiboze-level glevel))) | |
271 (not (string-match "^nnkiboze:" gname)) ; Exclude kibozes | |
272 (push (cons gname (1- (car (symbol-value group)))) | |
273 nnkiboze-newsrc))) | |
274 gnus-active-hashtb) | |
275 ;; `newsrc' is set to the list of groups that possibly are | |
276 ;; component groups to this kiboze group. This list has elements | |
277 ;; on the form `(GROUP . NUMBER)', where NUMBER is the highest | |
278 ;; number that has been kibozed in GROUP in this kiboze group. | |
279 (setq newsrc nnkiboze-newsrc) | |
280 (while newsrc | |
281 (if (not (setq active (gnus-gethash | |
282 (caar newsrc) gnus-active-hashtb))) | |
283 ;; This group isn't active after all, so we remove it from | |
284 ;; the list of component groups. | |
285 (setq nnkiboze-newsrc (delq (car newsrc) nnkiboze-newsrc)) | |
286 (setq lowest (cdar newsrc)) | |
287 ;; Ok, we have a valid component group, so we jump to it. | |
288 (switch-to-buffer gnus-group-buffer) | |
289 (gnus-group-jump-to-group (caar newsrc)) | |
290 (gnus-message 3 "nnkiboze: Checking %s..." (caar newsrc)) | |
291 (setq ginfo (gnus-get-info (gnus-group-group-name)) | |
292 orig-info (gnus-copy-sequence ginfo) | |
293 num-unread (car (gnus-gethash (caar newsrc) | |
294 gnus-newsrc-hashtb))) | |
295 (unwind-protect | |
296 (progn | |
297 ;; We set all list of article marks to nil. Since we operate | |
298 ;; on copies of the real lists, we can destroy anything we | |
299 ;; want here. | |
300 (when (nth 3 ginfo) | |
301 (setcar (nthcdr 3 ginfo) nil)) | |
302 ;; We set the list of read articles to be what we expect for | |
303 ;; this kiboze group -- either nil or `(1 . LOWEST)'. | |
304 (when ginfo | |
305 (setcar (nthcdr 2 ginfo) | |
306 (and (not (= lowest 1)) (cons 1 lowest)))) | |
307 (when (and (or (not ginfo) | |
308 (> (length (gnus-list-of-unread-articles | |
309 (car ginfo))) | |
310 0)) | |
311 (progn | |
312 (ignore-errors | |
313 (gnus-group-select-group nil)) | |
314 (eq major-mode 'gnus-summary-mode))) | |
315 ;; We are now in the group where we want to be. | |
316 (setq method (gnus-find-method-for-group | |
317 gnus-newsgroup-name)) | |
318 (when (eq method gnus-select-method) | |
319 (setq method nil)) | |
320 ;; We go through the list of scored articles. | |
321 (while gnus-newsgroup-scored | |
322 (when (> (caar gnus-newsgroup-scored) lowest) | |
323 ;; If it has a good score, then we enter this article | |
324 ;; into the kiboze group. | |
325 (nnkiboze-enter-nov | |
326 nov-buffer | |
327 (gnus-summary-article-header | |
328 (caar gnus-newsgroup-scored)) | |
329 gnus-newsgroup-name)) | |
330 (setq gnus-newsgroup-scored (cdr gnus-newsgroup-scored))) | |
331 ;; That's it. We exit this group. | |
332 (when (eq major-mode 'gnus-summary-mode) | |
333 (kill-buffer (current-buffer))))) | |
334 ;; Restore the proper info. | |
335 (when ginfo | |
336 (setcdr ginfo (cdr orig-info))) | |
337 (setcar (gnus-gethash (caar newsrc) gnus-newsrc-hashtb) | |
338 num-unread))) | |
339 (setcdr (car newsrc) (car active)) | |
340 (gnus-message 3 "nnkiboze: Checking %s...done" (caar newsrc)) | |
341 (setq newsrc (cdr newsrc))))) | |
17493 | 342 ;; We save the kiboze newsrc for this group. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
343 (with-temp-file newsrc-file |
17493 | 344 (insert "(setq nnkiboze-newsrc '") |
345 (gnus-prin1 nnkiboze-newsrc) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
346 (insert ")\n"))) |
32970
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
347 (unless inhibit-list-groups |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
348 (save-excursion |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
349 (set-buffer gnus-group-buffer) |
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
350 (gnus-group-list-groups))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
351 t) |
17493 | 352 |
353 (defun nnkiboze-enter-nov (buffer header group) | |
354 (save-excursion | |
355 (set-buffer buffer) | |
356 (goto-char (point-max)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
357 (let ((prefix (gnus-group-real-prefix group)) |
17493 | 358 (oheader (copy-sequence header)) |
359 article) | |
360 (if (zerop (forward-line -1)) | |
361 (progn | |
362 (setq article (1+ (read (current-buffer)))) | |
363 (forward-line 1)) | |
364 (setq article 1)) | |
365 (mail-header-set-number oheader article) | |
31785 | 366 (with-temp-buffer |
32970
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
367 (insert (or (mail-header-xref oheader) "")) |
31785 | 368 (goto-char (point-min)) |
369 (if (re-search-forward " [^ ]+:[0-9]+" nil t) | |
370 (goto-char (match-beginning 0)) | |
32970
343a1c02c422
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
371 (or (eobp) (forward-char 1))) |
31785 | 372 ;; The first Xref has to be the group this article |
373 ;; really came for - this is the article nnkiboze | |
374 ;; will request when it is asked for the article. | |
375 (insert " " group ":" | |
376 (int-to-string (mail-header-number header)) " ") | |
377 (while (re-search-forward " [^ ]+:[0-9]+" nil t) | |
378 (goto-char (1+ (match-beginning 0))) | |
379 (insert prefix)) | |
380 (mail-header-set-xref oheader (buffer-string))) | |
381 (nnheader-insert-nov oheader)))) | |
17493 | 382 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
383 (defun nnkiboze-nov-file-name (&optional suffix) |
17493 | 384 (concat (file-name-as-directory nnkiboze-directory) |
385 (nnheader-translate-file-chars | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
386 (concat (nnkiboze-prefixed-name nnkiboze-current-group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
387 (or suffix ".nov"))))) |
17493 | 388 |
389 (provide 'nnkiboze) | |
390 | |
391 ;;; nnkiboze.el ends here |