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