Mercurial > emacs
annotate lisp/gnus/gnus-start.el @ 51442:4c41fd813bd1
*** empty log message ***
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Tue, 03 Jun 2003 23:35:20 +0000 |
parents | bd315b9fa3f0 |
children | 695cf19ef79e d7ddb3e565de |
rev | line source |
---|---|
17493 | 1 ;;; gnus-start.el --- startup functions for Gnus |
42628
55e0120deff6
Add 2002 into copyright line.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
42627
diff
changeset
|
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
3 ;; Free Software Foundation, Inc. |
17493 | 4 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 6 ;; Keywords: news |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;;; Code: | |
28 | |
29 (require 'gnus) | |
30 (require 'gnus-win) | |
31 (require 'gnus-int) | |
32 (require 'gnus-spec) | |
33 (require 'gnus-range) | |
34 (require 'gnus-util) | |
35 (require 'message) | |
19520
6496595d79b8
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
36 (eval-when-compile (require 'cl)) |
17493 | 37 |
38 (defcustom gnus-startup-file (nnheader-concat gnus-home-directory ".newsrc") | |
39 "Your `.newsrc' file. | |
40 `.newsrc-SERVER' will be used instead if that exists." | |
41 :group 'gnus-start | |
42 :type 'file) | |
43 | |
44 (defcustom gnus-init-file (nnheader-concat gnus-home-directory ".gnus") | |
19910
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
45 "Your Gnus Emacs-Lisp startup file name. |
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
46 If a file with the `.el' or `.elc' suffixes exists, it will be read instead." |
17493 | 47 :group 'gnus-start |
48 :type 'file) | |
49 | |
50 (defcustom gnus-site-init-file | |
19520
6496595d79b8
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
51 (condition-case nil |
19910
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
52 (concat (file-name-directory |
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
53 (directory-file-name installation-directory)) |
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
54 "site-lisp/gnus-init") |
19520
6496595d79b8
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
55 (error nil)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
56 "The site-wide Gnus Emacs-Lisp startup file name, or nil if none. |
19910
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
57 If a file with the `.el' or `.elc' suffixes exists, it will be read instead." |
17493 | 58 :group 'gnus-start |
19910
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
59 :type '(choice file (const nil))) |
17493 | 60 |
61 (defcustom gnus-default-subscribed-newsgroups nil | |
19910
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
62 "List of newsgroups to subscribe, when a user runs Gnus the first time. |
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
63 The value should be a list of strings. |
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
64 If it is t, Gnus will not do anything special the first time it is |
17493 | 65 started; it'll just use the normal newsgroups subscription methods." |
66 :group 'gnus-start | |
19910
103cd29aea6f
(gnus-default-subscribed-newsgroups): Fix custom type. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19520
diff
changeset
|
67 :type '(choice (repeat string) (const :tag "Nothing special" t))) |
17493 | 68 |
69 (defcustom gnus-use-dribble-file t | |
70 "*Non-nil means that Gnus will use a dribble file to store user updates. | |
71 If Emacs should crash without saving the .newsrc files, complete | |
72 information can be restored from the dribble file." | |
73 :group 'gnus-dribble-file | |
74 :type 'boolean) | |
75 | |
76 (defcustom gnus-dribble-directory nil | |
77 "*The directory where dribble files will be saved. | |
78 If this variable is nil, the directory where the .newsrc files are | |
79 saved will be used." | |
80 :group 'gnus-dribble-file | |
81 :type '(choice directory (const nil))) | |
82 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
83 (defcustom gnus-check-new-newsgroups 'ask-server |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
84 "*Non-nil means that Gnus will run `gnus-find-new-newsgroups' at startup. |
17493 | 85 This normally finds new newsgroups by comparing the active groups the |
86 servers have already reported with those Gnus already knows, either alive | |
87 or killed. | |
88 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
89 When any of the following are true, `gnus-find-new-newsgroups' will instead |
17493 | 90 ask the servers (primary, secondary, and archive servers) to list new |
91 groups since the last time it checked: | |
92 1. This variable is `ask-server'. | |
93 2. This variable is a list of select methods (see below). | |
94 3. `gnus-read-active-file' is nil or `some'. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
95 4. A prefix argument is given to `gnus-find-new-newsgroups' interactively. |
17493 | 96 |
97 Thus, if this variable is `ask-server' or a list of select methods or | |
98 `gnus-read-active-file' is nil or `some', then the killed list is no | |
99 longer necessary, so you could safely set `gnus-save-killed-list' to nil. | |
100 | |
101 This variable can be a list of select methods which Gnus will query with | |
102 the `ask-server' method in addition to the primary, secondary, and archive | |
103 servers. | |
104 | |
105 Eg. | |
106 (setq gnus-check-new-newsgroups | |
107 '((nntp \"some.server\") (nntp \"other.server\"))) | |
108 | |
109 If this variable is nil, then you have to tell Gnus explicitly to | |
110 check for new newsgroups with \\<gnus-group-mode-map>\\[gnus-find-new-newsgroups]." | |
111 :group 'gnus-start | |
112 :type '(choice (const :tag "no" nil) | |
113 (const :tag "by brute force" t) | |
114 (const :tag "ask servers" ask-server) | |
115 (repeat :menu-tag "ask additional servers" | |
116 :tag "ask additional servers" | |
117 :value ((nntp "")) | |
118 (sexp :format "%v")))) | |
119 | |
120 (defcustom gnus-check-bogus-newsgroups nil | |
121 "*Non-nil means that Gnus will check and remove bogus newsgroup at startup. | |
122 If this variable is nil, then you have to tell Gnus explicitly to | |
123 check for bogus newsgroups with \\<gnus-group-mode-map>\\[gnus-group-check-bogus-groups]." | |
124 :group 'gnus-start-server | |
125 :type 'boolean) | |
126 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
127 (defcustom gnus-read-active-file 'some |
17493 | 128 "*Non-nil means that Gnus will read the entire active file at startup. |
129 If this variable is nil, Gnus will only know about the groups in your | |
130 `.newsrc' file. | |
131 | |
132 If this variable is `some', Gnus will try to only read the relevant | |
133 parts of the active file from the server. Not all servers support | |
134 this, and it might be quite slow with other servers, but this should | |
135 generally be faster than both the t and nil value. | |
136 | |
137 If you set this variable to nil or `some', you probably still want to | |
138 be told about new newsgroups that arrive. To do that, set | |
139 `gnus-check-new-newsgroups' to `ask-server'. This may not work | |
140 properly with all servers." | |
141 :group 'gnus-start-server | |
142 :type '(choice (const nil) | |
143 (const some) | |
144 (const t))) | |
145 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
146 (defconst gnus-level-subscribed 5 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
147 "Groups with levels less than or equal to this variable are subscribed.") |
17493 | 148 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
149 (defconst gnus-level-unsubscribed 7 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
150 "Groups with levels less than or equal to this variable are unsubscribed. |
17493 | 151 Groups with levels less than `gnus-level-subscribed', which should be |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
152 less than this variable, are subscribed.") |
17493 | 153 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
154 (defconst gnus-level-zombie 8 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
155 "Groups with this level are zombie groups.") |
17493 | 156 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
157 (defconst gnus-level-killed 9 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
158 "Groups with this level are killed.") |
17493 | 159 |
160 (defcustom gnus-level-default-subscribed 3 | |
161 "*New subscribed groups will be subscribed at this level." | |
162 :group 'gnus-group-levels | |
163 :type 'integer) | |
164 | |
165 (defcustom gnus-level-default-unsubscribed 6 | |
166 "*New unsubscribed groups will be unsubscribed at this level." | |
167 :group 'gnus-group-levels | |
168 :type 'integer) | |
169 | |
170 (defcustom gnus-activate-level (1+ gnus-level-subscribed) | |
171 "*Groups higher than this level won't be activated on startup. | |
172 Setting this variable to something low might save lots of time when | |
173 you have many groups that you aren't interested in." | |
174 :group 'gnus-group-levels | |
175 :type 'integer) | |
176 | |
177 (defcustom gnus-activate-foreign-newsgroups 4 | |
178 "*If nil, Gnus will not check foreign newsgroups at startup. | |
179 If it is non-nil, it should be a number between one and nine. Foreign | |
180 newsgroups that have a level lower or equal to this number will be | |
181 activated on startup. For instance, if you want to active all | |
182 subscribed newsgroups, but not the rest, you'd set this variable to | |
183 `gnus-level-subscribed'. | |
184 | |
185 If you subscribe to lots of newsgroups from different servers, startup | |
186 might take a while. By setting this variable to nil, you'll save time, | |
187 but you won't be told how many unread articles there are in the | |
188 groups." | |
189 :group 'gnus-group-levels | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
190 :type '(choice integer |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
191 (const :tag "none" nil))) |
17493 | 192 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
193 (defcustom gnus-read-newsrc-file t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
194 "*Non-nil means that Gnus will read the `.newsrc' file. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
195 Gnus always reads its own startup file, which is called |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
196 \".newsrc.eld\". The file called \".newsrc\" is in a format that can |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
197 be readily understood by other newsreaders. If you don't plan on |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
198 using other newsreaders, set this variable to nil to save some time on |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
199 entry." |
33396
e2512753e160
(gnus-read-newsrc-file): Add :version.
Dave Love <fx@gnu.org>
parents:
33327
diff
changeset
|
200 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
201 :group 'gnus-newsrc |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
202 :type 'boolean) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
203 |
17493 | 204 (defcustom gnus-save-newsrc-file t |
205 "*Non-nil means that Gnus will save the `.newsrc' file. | |
206 Gnus always saves its own startup file, which is called | |
207 \".newsrc.eld\". The file called \".newsrc\" is in a format that can | |
208 be readily understood by other newsreaders. If you don't plan on | |
209 using other newsreaders, set this variable to nil to save some time on | |
210 exit." | |
211 :group 'gnus-newsrc | |
212 :type 'boolean) | |
213 | |
214 (defcustom gnus-save-killed-list t | |
215 "*If non-nil, save the list of killed groups to the startup file. | |
216 If you set this variable to nil, you'll save both time (when starting | |
217 and quitting) and space (both memory and disk), but it will also mean | |
218 that Gnus has no record of which groups are new and which are old, so | |
219 the automatic new newsgroups subscription methods become meaningless. | |
220 | |
221 You should always set `gnus-check-new-newsgroups' to `ask-server' or | |
222 nil if you set this variable to nil. | |
223 | |
224 This variable can also be a regexp. In that case, all groups that do | |
225 not match this regexp will be removed before saving the list." | |
226 :group 'gnus-newsrc | |
227 :type 'boolean) | |
228 | |
229 (defcustom gnus-ignored-newsgroups | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
230 (mapconcat 'identity |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
231 '("^to\\." ; not "real" groups |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
232 "^[0-9. \t]+ " ; all digits in name |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
233 "^[\"][]\"[#'()]" ; bogus characters |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
234 ) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
235 "\\|") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
236 "*A regexp to match uninteresting newsgroups in the active file. |
17493 | 237 Any lines in the active file matching this regular expression are |
238 removed from the newsgroup list before anything else is done to it, | |
239 thus making them effectively non-existent." | |
240 :group 'gnus-group-new | |
241 :type 'regexp) | |
242 | |
243 (defcustom gnus-subscribe-newsgroup-method 'gnus-subscribe-zombies | |
244 "*Function called with a group name when new group is detected. | |
245 A few pre-made functions are supplied: `gnus-subscribe-randomly' | |
246 inserts new groups at the beginning of the list of groups; | |
247 `gnus-subscribe-alphabetically' inserts new groups in strict | |
248 alphabetic order; `gnus-subscribe-hierarchically' inserts new groups | |
249 in hierarchical newsgroup order; `gnus-subscribe-interactively' asks | |
250 for your decision; `gnus-subscribe-killed' kills all new groups; | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
251 `gnus-subscribe-zombies' will make all new groups into zombies; |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
252 `gnus-subscribe-topics' will enter groups into the topics that |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
253 claim them." |
17493 | 254 :group 'gnus-group-new |
255 :type '(radio (function-item gnus-subscribe-randomly) | |
256 (function-item gnus-subscribe-alphabetically) | |
257 (function-item gnus-subscribe-hierarchically) | |
258 (function-item gnus-subscribe-interactively) | |
259 (function-item gnus-subscribe-killed) | |
260 (function-item gnus-subscribe-zombies) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
261 (function-item gnus-subscribe-topics) |
17493 | 262 function)) |
263 | |
264 (defcustom gnus-subscribe-options-newsgroup-method | |
265 'gnus-subscribe-alphabetically | |
266 "*This function is called to subscribe newsgroups mentioned on \"options -n\" lines. | |
267 If, for instance, you want to subscribe to all newsgroups in the | |
268 \"no\" and \"alt\" hierarchies, you'd put the following in your | |
269 .newsrc file: | |
270 | |
271 options -n no.all alt.all | |
272 | |
273 Gnus will the subscribe all new newsgroups in these hierarchies with | |
274 the subscription method in this variable." | |
275 :group 'gnus-group-new | |
276 :type '(radio (function-item gnus-subscribe-randomly) | |
277 (function-item gnus-subscribe-alphabetically) | |
278 (function-item gnus-subscribe-hierarchically) | |
279 (function-item gnus-subscribe-interactively) | |
280 (function-item gnus-subscribe-killed) | |
281 (function-item gnus-subscribe-zombies) | |
282 function)) | |
283 | |
284 (defcustom gnus-subscribe-hierarchical-interactive nil | |
285 "*If non-nil, Gnus will offer to subscribe hierarchically. | |
286 When a new hierarchy appears, Gnus will ask the user: | |
287 | |
288 'alt.binaries': Do you want to subscribe to this hierarchy? ([d]ys): | |
289 | |
290 If the user pressed `d', Gnus will descend the hierarchy, `y' will | |
291 subscribe to all newsgroups in the hierarchy and `s' will skip this | |
292 hierarchy in its entirety." | |
293 :group 'gnus-group-new | |
294 :type 'boolean) | |
295 | |
296 (defcustom gnus-auto-subscribed-groups | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
297 "nnml\\|^nnfolder\\|^nnmbox\\|^nnmh\\|^nnbabyl" |
17493 | 298 "*All new groups that match this regexp will be subscribed automatically. |
299 Note that this variable only deals with new groups. It has no effect | |
300 whatsoever on old groups. | |
301 | |
302 New groups that match this regexp will not be handled by | |
303 `gnus-subscribe-newsgroup-method'. Instead, they will | |
304 be subscribed using `gnus-subscribe-options-newsgroup-method'." | |
305 :group 'gnus-group-new | |
306 :type 'regexp) | |
307 | |
308 (defcustom gnus-options-subscribe nil | |
309 "*All new groups matching this regexp will be subscribed unconditionally. | |
310 Note that this variable deals only with new newsgroups. This variable | |
311 does not affect old newsgroups. | |
312 | |
313 New groups that match this regexp will not be handled by | |
314 `gnus-subscribe-newsgroup-method'. Instead, they will | |
315 be subscribed using `gnus-subscribe-options-newsgroup-method'." | |
316 :group 'gnus-group-new | |
317 :type '(choice regexp | |
318 (const :tag "none" nil))) | |
319 | |
320 (defcustom gnus-options-not-subscribe nil | |
321 "*All new groups matching this regexp will be ignored. | |
322 Note that this variable deals only with new newsgroups. This variable | |
323 does not affect old (already subscribed) newsgroups." | |
324 :group 'gnus-group-new | |
325 :type '(choice regexp | |
326 (const :tag "none" nil))) | |
327 | |
328 (defcustom gnus-modtime-botch nil | |
329 "*Non-nil means .newsrc should be deleted prior to save. | |
330 Its use is due to the bogus appearance that .newsrc was modified on | |
331 disc." | |
332 :group 'gnus-newsrc | |
333 :type 'boolean) | |
334 | |
335 (defcustom gnus-check-bogus-groups-hook nil | |
336 "A hook run after removing bogus groups." | |
337 :group 'gnus-start-server | |
338 :type 'hook) | |
339 | |
340 (defcustom gnus-startup-hook nil | |
341 "A hook called at startup. | |
342 This hook is called after Gnus is connected to the NNTP server." | |
343 :group 'gnus-start | |
344 :type 'hook) | |
345 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
346 (defcustom gnus-before-startup-hook nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
347 "A hook called at before startup. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
348 This hook is called as the first thing when Gnus is started." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
349 :group 'gnus-start |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
350 :type 'hook) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
351 |
17493 | 352 (defcustom gnus-started-hook nil |
353 "A hook called as the last thing after startup." | |
354 :group 'gnus-start | |
355 :type 'hook) | |
356 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
357 (defcustom gnus-setup-news-hook nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
358 "A hook after reading the .newsrc file, but before generating the buffer." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
359 :group 'gnus-start |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
360 :type 'hook) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
361 |
17493 | 362 (defcustom gnus-get-new-news-hook nil |
363 "A hook run just before Gnus checks for new news." | |
364 :group 'gnus-group-new | |
365 :type 'hook) | |
366 | |
367 (defcustom gnus-after-getting-new-news-hook | |
368 (when (gnus-boundp 'display-time-timer) | |
369 '(display-time-event-handler)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
370 "*A hook run after Gnus checks for new news when Gnus is already running." |
17493 | 371 :group 'gnus-group-new |
372 :type 'hook) | |
373 | |
374 (defcustom gnus-save-newsrc-hook nil | |
375 "A hook called before saving any of the newsrc files." | |
376 :group 'gnus-newsrc | |
377 :type 'hook) | |
378 | |
379 (defcustom gnus-save-quick-newsrc-hook nil | |
380 "A hook called just before saving the quick newsrc file. | |
381 Can be used to turn version control on or off." | |
382 :group 'gnus-newsrc | |
383 :type 'hook) | |
384 | |
385 (defcustom gnus-save-standard-newsrc-hook nil | |
386 "A hook called just before saving the standard newsrc file. | |
387 Can be used to turn version control on or off." | |
388 :group 'gnus-newsrc | |
389 :type 'hook) | |
390 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
391 (defcustom gnus-always-read-dribble-file nil |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
392 "Unconditionally read the dribble file." |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
393 :group 'gnus-newsrc |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
394 :type 'boolean) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
395 |
38627
6520def531cc
(gnus-startup-file-coding-system): Revert to binary.
Gerd Moellmann <gerd@gnu.org>
parents:
38612
diff
changeset
|
396 ;;; Internal variables |
6520def531cc
(gnus-startup-file-coding-system): Revert to binary.
Gerd Moellmann <gerd@gnu.org>
parents:
38612
diff
changeset
|
397 |
42627
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
398 (defvar gnus-ding-file-coding-system mm-universal-coding-system |
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
399 "Coding system for ding file.") |
17493 | 400 |
401 (defvar gnus-newsrc-file-version nil) | |
402 (defvar gnus-override-subscribe-method nil) | |
403 (defvar gnus-dribble-buffer nil) | |
404 (defvar gnus-newsrc-options nil | |
405 "Options line in the .newsrc file.") | |
406 | |
407 (defvar gnus-newsrc-options-n nil | |
408 "List of regexps representing groups to be subscribed/ignored unconditionally.") | |
409 | |
410 (defvar gnus-newsrc-last-checked-date nil | |
411 "Date Gnus last asked server for new newsgroups.") | |
412 | |
413 (defvar gnus-current-startup-file nil | |
414 "Startup file for the current host.") | |
415 | |
416 ;; Byte-compiler warning. | |
417 (defvar gnus-group-line-format) | |
418 | |
419 ;; Suggested by Brian Edmonds <edmonds@cs.ubc.ca>. | |
420 (defvar gnus-init-inhibit nil) | |
421 (defun gnus-read-init-file (&optional inhibit-next) | |
422 ;; Don't load .gnus if the -q option was used. | |
423 (when init-file-user | |
424 (if gnus-init-inhibit | |
425 (setq gnus-init-inhibit nil) | |
426 (setq gnus-init-inhibit inhibit-next) | |
42627
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
427 (dolist (file (list gnus-site-init-file gnus-init-file)) |
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
428 (when (and file |
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
429 (locate-library file)) |
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
430 (if (or debug-on-error debug-on-quit) |
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
431 (load file nil t) |
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
432 (condition-case var |
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
433 (load file nil t) |
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
434 (error |
2270bf351eba
* gnus-start.el (gnus-read-init-file): Cleaned up.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38627
diff
changeset
|
435 (error "Error in %s: %s" file var))))))))) |
17493 | 436 |
437 ;; For subscribing new newsgroup | |
438 | |
439 (defun gnus-subscribe-hierarchical-interactive (groups) | |
440 (let ((groups (sort groups 'string<)) | |
441 prefixes prefix start ans group starts) | |
442 (while groups | |
443 (setq prefixes (list "^")) | |
444 (while (and groups prefixes) | |
445 (while (not (string-match (car prefixes) (car groups))) | |
446 (setq prefixes (cdr prefixes))) | |
447 (setq prefix (car prefixes)) | |
448 (setq start (1- (length prefix))) | |
449 (if (and (string-match "[^\\.]\\." (car groups) start) | |
450 (cdr groups) | |
451 (setq prefix | |
452 (concat "^" (substring (car groups) 0 (match-end 0)))) | |
453 (string-match prefix (cadr groups))) | |
454 (progn | |
455 (push prefix prefixes) | |
456 (message "Descend hierarchy %s? ([y]nsq): " | |
457 (substring prefix 1 (1- (length prefix)))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
458 (while (not (memq (setq ans (read-char-exclusive)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
459 '(?y ?\n ?\r ?n ?s ?q))) |
17493 | 460 (ding) |
461 (message "Descend hierarchy %s? ([y]nsq): " | |
462 (substring prefix 1 (1- (length prefix))))) | |
463 (cond ((= ans ?n) | |
464 (while (and groups | |
465 (string-match prefix | |
466 (setq group (car groups)))) | |
467 (push group gnus-killed-list) | |
468 (gnus-sethash group group gnus-killed-hashtb) | |
469 (setq groups (cdr groups))) | |
470 (setq starts (cdr starts))) | |
471 ((= ans ?s) | |
472 (while (and groups | |
473 (string-match prefix | |
474 (setq group (car groups)))) | |
475 (gnus-sethash group group gnus-killed-hashtb) | |
476 (gnus-subscribe-alphabetically (car groups)) | |
477 (setq groups (cdr groups))) | |
478 (setq starts (cdr starts))) | |
479 ((= ans ?q) | |
480 (while groups | |
481 (setq group (car groups)) | |
482 (push group gnus-killed-list) | |
483 (gnus-sethash group group gnus-killed-hashtb) | |
484 (setq groups (cdr groups)))) | |
485 (t nil))) | |
486 (message "Subscribe %s? ([n]yq)" (car groups)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
487 (while (not (memq (setq ans (read-char-exclusive)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
488 '(?y ?\n ?\r ?q ?n))) |
17493 | 489 (ding) |
490 (message "Subscribe %s? ([n]yq)" (car groups))) | |
491 (setq group (car groups)) | |
492 (cond ((= ans ?y) | |
493 (gnus-subscribe-alphabetically (car groups)) | |
494 (gnus-sethash group group gnus-killed-hashtb)) | |
495 ((= ans ?q) | |
496 (while groups | |
497 (setq group (car groups)) | |
498 (push group gnus-killed-list) | |
499 (gnus-sethash group group gnus-killed-hashtb) | |
500 (setq groups (cdr groups)))) | |
501 (t | |
502 (push group gnus-killed-list) | |
503 (gnus-sethash group group gnus-killed-hashtb))) | |
504 (setq groups (cdr groups))))))) | |
505 | |
506 (defun gnus-subscribe-randomly (newsgroup) | |
507 "Subscribe new NEWSGROUP by making it the first newsgroup." | |
508 (gnus-subscribe-newsgroup newsgroup)) | |
509 | |
510 (defun gnus-subscribe-alphabetically (newgroup) | |
511 "Subscribe new NEWSGROUP and insert it in alphabetical order." | |
512 (let ((groups (cdr gnus-newsrc-alist)) | |
513 before) | |
514 (while (and (not before) groups) | |
515 (if (string< newgroup (caar groups)) | |
516 (setq before (caar groups)) | |
517 (setq groups (cdr groups)))) | |
518 (gnus-subscribe-newsgroup newgroup before))) | |
519 | |
520 (defun gnus-subscribe-hierarchically (newgroup) | |
521 "Subscribe new NEWSGROUP and insert it in hierarchical newsgroup order." | |
522 ;; Basic ideas by mike-w@cs.aukuni.ac.nz (Mike Williams) | |
523 (save-excursion | |
524 (set-buffer (nnheader-find-file-noselect gnus-current-startup-file)) | |
525 (let ((groupkey newgroup) | |
526 before) | |
527 (while (and (not before) groupkey) | |
528 (goto-char (point-min)) | |
529 (let ((groupkey-re | |
530 (concat "^\\(" (regexp-quote groupkey) ".*\\)[!:]"))) | |
531 (while (and (re-search-forward groupkey-re nil t) | |
532 (progn | |
533 (setq before (match-string 1)) | |
534 (string< before newgroup))))) | |
535 ;; Remove tail of newsgroup name (eg. a.b.c -> a.b) | |
536 (setq groupkey | |
537 (when (string-match "^\\(.*\\)\\.[^.]+$" groupkey) | |
538 (substring groupkey (match-beginning 1) (match-end 1))))) | |
539 (gnus-subscribe-newsgroup newgroup before)) | |
540 (kill-buffer (current-buffer)))) | |
541 | |
542 (defun gnus-subscribe-interactively (group) | |
543 "Subscribe the new GROUP interactively. | |
544 It is inserted in hierarchical newsgroup order if subscribed. If not, | |
545 it is killed." | |
546 (if (gnus-y-or-n-p (format "Subscribe new newsgroup: %s " group)) | |
547 (gnus-subscribe-hierarchically group) | |
548 (push group gnus-killed-list))) | |
549 | |
550 (defun gnus-subscribe-zombies (group) | |
551 "Make the new GROUP into a zombie group." | |
552 (push group gnus-zombie-list)) | |
553 | |
554 (defun gnus-subscribe-killed (group) | |
555 "Make the new GROUP a killed group." | |
556 (push group gnus-killed-list)) | |
557 | |
558 (defun gnus-subscribe-newsgroup (newsgroup &optional next) | |
559 "Subscribe new NEWSGROUP. | |
560 If NEXT is non-nil, it is inserted before NEXT. Otherwise it is made | |
561 the first newsgroup." | |
562 (save-excursion | |
563 (goto-char (point-min)) | |
564 ;; We subscribe the group by changing its level to `subscribed'. | |
565 (gnus-group-change-level | |
566 newsgroup gnus-level-default-subscribed | |
567 gnus-level-killed (gnus-gethash (or next "dummy.group") | |
568 gnus-newsrc-hashtb)) | |
569 (gnus-message 5 "Subscribe newsgroup: %s" newsgroup))) | |
570 | |
571 (defun gnus-read-active-file-p () | |
572 "Say whether the active file has been read from `gnus-select-method'." | |
573 (memq gnus-select-method gnus-have-read-active-file)) | |
574 | |
575 ;;; General various misc type functions. | |
576 | |
577 ;; Silence byte-compiler. | |
578 (defvar gnus-current-headers) | |
579 (defvar gnus-thread-indent-array) | |
580 (defvar gnus-newsgroup-name) | |
581 (defvar gnus-newsgroup-headers) | |
582 (defvar gnus-group-list-mode) | |
583 (defvar gnus-group-mark-positions) | |
584 (defvar gnus-newsgroup-data) | |
585 (defvar gnus-newsgroup-unreads) | |
586 (defvar nnoo-state-alist) | |
587 (defvar gnus-current-select-method) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
588 |
17493 | 589 (defun gnus-clear-system () |
590 "Clear all variables and buffers." | |
591 ;; Clear Gnus variables. | |
592 (let ((variables gnus-variable-list)) | |
593 (while variables | |
594 (set (car variables) nil) | |
595 (setq variables (cdr variables)))) | |
596 ;; Clear other internal variables. | |
597 (setq gnus-list-of-killed-groups nil | |
598 gnus-have-read-active-file nil | |
599 gnus-newsrc-alist nil | |
600 gnus-newsrc-hashtb nil | |
601 gnus-killed-list nil | |
602 gnus-zombie-list nil | |
603 gnus-killed-hashtb nil | |
604 gnus-active-hashtb nil | |
605 gnus-moderated-hashtb nil | |
606 gnus-description-hashtb nil | |
607 gnus-current-headers nil | |
608 gnus-thread-indent-array nil | |
609 gnus-newsgroup-headers nil | |
610 gnus-newsgroup-name nil | |
611 gnus-server-alist nil | |
612 gnus-group-list-mode nil | |
613 gnus-opened-servers nil | |
614 gnus-group-mark-positions nil | |
615 gnus-newsgroup-data nil | |
616 gnus-newsgroup-unreads nil | |
617 nnoo-state-alist nil | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
618 gnus-current-select-method nil |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
619 nnmail-split-history nil |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
620 gnus-ephemeral-servers nil) |
17493 | 621 (gnus-shutdown 'gnus) |
622 ;; Kill the startup file. | |
623 (and gnus-current-startup-file | |
624 (get-file-buffer gnus-current-startup-file) | |
625 (kill-buffer (get-file-buffer gnus-current-startup-file))) | |
626 ;; Clear the dribble buffer. | |
627 (gnus-dribble-clear) | |
628 ;; Kill global KILL file buffer. | |
629 (when (get-file-buffer (gnus-newsgroup-kill-file nil)) | |
630 (kill-buffer (get-file-buffer (gnus-newsgroup-kill-file nil)))) | |
631 (gnus-kill-buffer nntp-server-buffer) | |
632 ;; Kill Gnus buffers. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
633 (let ((buffers (gnus-buffers))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
634 (when buffers |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
635 (mapcar 'kill-buffer buffers))) |
17493 | 636 ;; Remove Gnus frames. |
637 (gnus-kill-gnus-frames)) | |
638 | |
639 (defun gnus-no-server-1 (&optional arg slave) | |
640 "Read network news. | |
641 If ARG is a positive number, Gnus will use that as the | |
642 startup level. If ARG is nil, Gnus will be started at level 2. | |
643 If ARG is non-nil and not a positive number, Gnus will | |
644 prompt the user for the name of an NNTP server to use. | |
645 As opposed to `gnus', this command will not connect to the local server." | |
646 (interactive "P") | |
647 (let ((val (or arg (1- gnus-level-default-subscribed)))) | |
648 (gnus val t slave) | |
649 (make-local-variable 'gnus-group-use-permanent-levels) | |
650 (setq gnus-group-use-permanent-levels val))) | |
651 | |
652 (defun gnus-1 (&optional arg dont-connect slave) | |
653 "Read network news. | |
654 If ARG is non-nil and a positive number, Gnus will use that as the | |
655 startup level. If ARG is non-nil and not a positive number, Gnus will | |
656 prompt the user for the name of an NNTP server to use." | |
657 (interactive "P") | |
658 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
659 (if (gnus-alive-p) |
17493 | 660 (progn |
661 (switch-to-buffer gnus-group-buffer) | |
662 (gnus-group-get-new-news | |
663 (and (numberp arg) | |
664 (> arg 0) | |
665 (max (car gnus-group-list-mode) arg)))) | |
666 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
667 (gnus-clear-system) |
17493 | 668 (gnus-splash) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
669 (gnus-run-hooks 'gnus-before-startup-hook) |
17493 | 670 (nnheader-init-server-buffer) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
671 (setq gnus-slave slave) |
17493 | 672 (gnus-read-init-file) |
673 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
674 (when gnus-simple-splash |
17493 | 675 (setq gnus-simple-splash nil) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
676 (cond |
32939
c8119677d63e
Use (featurep 'xemacs) instead of the `gnus-xemacs' variable, as the
Miles Bader <miles@gnu.org>
parents:
31783
diff
changeset
|
677 ((featurep 'xemacs) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
678 (gnus-xmas-splash)) |
31783
65104da03c90
(gnus-1) <gnus-simple-splash>: Don't test for X
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
679 ((and window-system |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
680 (= (frame-height) (1+ (window-height)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
681 (gnus-x-splash)))) |
17493 | 682 |
683 (let ((level (and (numberp arg) (> arg 0) arg)) | |
684 did-connect) | |
685 (unwind-protect | |
686 (progn | |
687 (unless dont-connect | |
688 (setq did-connect | |
689 (gnus-start-news-server (and arg (not level)))))) | |
690 (if (and (not dont-connect) | |
691 (not did-connect)) | |
692 (gnus-group-quit) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
693 (gnus-run-hooks 'gnus-startup-hook) |
17493 | 694 ;; NNTP server is successfully open. |
695 | |
696 ;; Find the current startup file name. | |
697 (setq gnus-current-startup-file | |
698 (gnus-make-newsrc-file gnus-startup-file)) | |
699 | |
700 ;; Read the dribble file. | |
701 (when (or gnus-slave gnus-use-dribble-file) | |
702 (gnus-dribble-read-file)) | |
703 | |
704 ;; Allow using GroupLens predictions. | |
705 (when gnus-use-grouplens | |
706 (bbb-login) | |
707 (add-hook 'gnus-summary-mode-hook 'gnus-grouplens-mode)) | |
708 | |
709 ;; Do the actual startup. | |
710 (gnus-setup-news nil level dont-connect) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
711 (gnus-run-hooks 'gnus-setup-news-hook) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
712 (gnus-start-draft-setup) |
17493 | 713 ;; Generate the group buffer. |
714 (gnus-group-list-groups level) | |
715 (gnus-group-first-unread-group) | |
716 (gnus-configure-windows 'group) | |
717 (gnus-group-set-mode-line) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
718 (gnus-run-hooks 'gnus-started-hook)))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
719 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
720 (defun gnus-start-draft-setup () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
721 "Make sure the draft group exists." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
722 (gnus-request-create-group "drafts" '(nndraft "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
723 (unless (gnus-gethash "nndraft:drafts" gnus-newsrc-hashtb) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
724 (let ((gnus-level-default-subscribed 1)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
725 (gnus-subscribe-group "nndraft:drafts" nil '(nndraft ""))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
726 (gnus-group-set-parameter |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
727 "nndraft:drafts" 'gnus-dummy '((gnus-draft-mode))))) |
17493 | 728 |
729 ;;;###autoload | |
730 (defun gnus-unload () | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
731 "Unload all Gnus features. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
732 \(For some value of `all' or `Gnus'.) Currently, features whose names |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
733 have prefixes `gnus-', `nn', `mm-' or `rfc' are unloaded. Use |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
734 cautiously -- unloading may cause trouble." |
17493 | 735 (interactive) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
736 (dolist (feature features) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
737 (if (string-match "^\\(gnus-\\|nn\\|mm-\\|rfc\\)" (symbol-name feature)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
738 (unload-feature feature 'force)))) |
17493 | 739 |
740 | |
741 ;;; | |
742 ;;; Dribble file | |
743 ;;; | |
744 | |
745 (defvar gnus-dribble-ignore nil) | |
746 (defvar gnus-dribble-eval-file nil) | |
747 | |
748 (defun gnus-dribble-file-name () | |
749 "Return the dribble file for the current .newsrc." | |
750 (concat | |
751 (if gnus-dribble-directory | |
752 (concat (file-name-as-directory gnus-dribble-directory) | |
753 (file-name-nondirectory gnus-current-startup-file)) | |
754 gnus-current-startup-file) | |
755 "-dribble")) | |
756 | |
757 (defun gnus-dribble-enter (string) | |
758 "Enter STRING into the dribble buffer." | |
759 (when (and (not gnus-dribble-ignore) | |
760 gnus-dribble-buffer | |
761 (buffer-name gnus-dribble-buffer)) | |
762 (let ((obuf (current-buffer))) | |
763 (set-buffer gnus-dribble-buffer) | |
764 (goto-char (point-max)) | |
765 (insert string "\n") | |
766 (set-window-point (get-buffer-window (current-buffer)) (point-max)) | |
767 (bury-buffer gnus-dribble-buffer) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
768 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
769 (set-buffer gnus-group-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
770 (gnus-group-set-mode-line)) |
17493 | 771 (set-buffer obuf)))) |
772 | |
773 (defun gnus-dribble-touch () | |
774 "Touch the dribble buffer." | |
775 (gnus-dribble-enter "")) | |
776 | |
777 (defun gnus-dribble-read-file () | |
778 "Read the dribble file from disk." | |
779 (let ((dribble-file (gnus-dribble-file-name))) | |
780 (save-excursion | |
781 (set-buffer (setq gnus-dribble-buffer | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
782 (gnus-get-buffer-create |
17493 | 783 (file-name-nondirectory dribble-file)))) |
784 (erase-buffer) | |
785 (setq buffer-file-name dribble-file) | |
786 (auto-save-mode t) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
787 (buffer-disable-undo) |
17493 | 788 (bury-buffer (current-buffer)) |
789 (set-buffer-modified-p nil) | |
790 (let ((auto (make-auto-save-file-name)) | |
791 (gnus-dribble-ignore t) | |
792 modes) | |
793 (when (or (file-exists-p auto) (file-exists-p dribble-file)) | |
794 ;; Load whichever file is newest -- the auto save file | |
795 ;; or the "real" file. | |
796 (if (file-newer-than-file-p auto dribble-file) | |
797 (nnheader-insert-file-contents auto) | |
798 (nnheader-insert-file-contents dribble-file)) | |
799 (unless (zerop (buffer-size)) | |
800 (set-buffer-modified-p t)) | |
801 ;; Set the file modes to reflect the .newsrc file modes. | |
802 (save-buffer) | |
803 (when (and (file-exists-p gnus-current-startup-file) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
804 (file-exists-p dribble-file) |
17493 | 805 (setq modes (file-modes gnus-current-startup-file))) |
806 (set-file-modes dribble-file modes)) | |
807 ;; Possibly eval the file later. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
808 (when (or gnus-always-read-dribble-file |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
809 (gnus-y-or-n-p |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
810 "Gnus auto-save file exists. Do you want to read it? ")) |
17493 | 811 (setq gnus-dribble-eval-file t))))))) |
812 | |
813 (defun gnus-dribble-eval-file () | |
814 (when gnus-dribble-eval-file | |
815 (setq gnus-dribble-eval-file nil) | |
816 (save-excursion | |
817 (let ((gnus-dribble-ignore t)) | |
818 (set-buffer gnus-dribble-buffer) | |
819 (eval-buffer (current-buffer)))))) | |
820 | |
821 (defun gnus-dribble-delete-file () | |
822 (when (file-exists-p (gnus-dribble-file-name)) | |
823 (delete-file (gnus-dribble-file-name))) | |
824 (when gnus-dribble-buffer | |
825 (save-excursion | |
826 (set-buffer gnus-dribble-buffer) | |
827 (let ((auto (make-auto-save-file-name))) | |
828 (when (file-exists-p auto) | |
829 (delete-file auto)) | |
830 (erase-buffer) | |
831 (set-buffer-modified-p nil))))) | |
832 | |
833 (defun gnus-dribble-save () | |
834 (when (and gnus-dribble-buffer | |
835 (buffer-name gnus-dribble-buffer)) | |
836 (save-excursion | |
837 (set-buffer gnus-dribble-buffer) | |
838 (save-buffer)))) | |
839 | |
840 (defun gnus-dribble-clear () | |
841 (when (gnus-buffer-exists-p gnus-dribble-buffer) | |
842 (save-excursion | |
843 (set-buffer gnus-dribble-buffer) | |
844 (erase-buffer) | |
845 (set-buffer-modified-p nil) | |
846 (setq buffer-saved-size (buffer-size))))) | |
847 | |
848 | |
849 ;;; | |
850 ;;; Active & Newsrc File Handling | |
851 ;;; | |
852 | |
853 (defun gnus-setup-news (&optional rawfile level dont-connect) | |
854 "Setup news information. | |
855 If RAWFILE is non-nil, the .newsrc file will also be read. | |
856 If LEVEL is non-nil, the news will be set up at level LEVEL." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
857 (require 'nnmail) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
858 (let ((init (not (and gnus-newsrc-alist gnus-active-hashtb (not rawfile)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
859 ;; Binding this variable will inhibit multiple fetchings |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
860 ;; of the same mail source. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
861 (nnmail-fetched-sources (list t))) |
17493 | 862 |
863 (when init | |
864 ;; Clear some variables to re-initialize news information. | |
865 (setq gnus-newsrc-alist nil | |
866 gnus-active-hashtb nil) | |
867 ;; Read the newsrc file and create `gnus-newsrc-hashtb'. | |
868 (gnus-read-newsrc-file rawfile)) | |
869 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
870 ;; Make sure the archive server is available to all and sundry. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
871 (when gnus-message-archive-method |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
872 (setq gnus-server-alist (delq (assoc "archive" gnus-server-alist) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
873 gnus-server-alist)) |
17493 | 874 (push (cons "archive" gnus-message-archive-method) |
875 gnus-server-alist)) | |
876 | |
877 ;; If we don't read the complete active file, we fill in the | |
878 ;; hashtb here. | |
879 (when (or (null gnus-read-active-file) | |
880 (eq gnus-read-active-file 'some)) | |
881 (gnus-update-active-hashtb-from-killed)) | |
882 | |
883 ;; Read the active file and create `gnus-active-hashtb'. | |
884 ;; If `gnus-read-active-file' is nil, then we just create an empty | |
885 ;; hash table. The partial filling out of the hash table will be | |
886 ;; done in `gnus-get-unread-articles'. | |
887 (and gnus-read-active-file | |
888 (not level) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
889 (gnus-read-active-file nil dont-connect)) |
17493 | 890 |
891 (unless gnus-active-hashtb | |
892 (setq gnus-active-hashtb (gnus-make-hashtable 4096))) | |
893 | |
894 ;; Initialize the cache. | |
895 (when gnus-use-cache | |
896 (gnus-cache-open)) | |
897 | |
898 ;; Possibly eval the dribble file. | |
899 (and init | |
900 (or gnus-use-dribble-file gnus-slave) | |
901 (gnus-dribble-eval-file)) | |
902 | |
903 ;; Slave Gnusii should then clear the dribble buffer. | |
904 (when (and init gnus-slave) | |
905 (gnus-dribble-clear)) | |
906 | |
907 (gnus-update-format-specifications) | |
908 | |
909 ;; See whether we need to read the description file. | |
910 (when (and (boundp 'gnus-group-line-format) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
911 (let ((case-fold-search nil)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
912 (string-match "%[-,0-9]*D" gnus-group-line-format)) |
17493 | 913 (not gnus-description-hashtb) |
914 (not dont-connect) | |
915 gnus-read-active-file) | |
916 (gnus-read-all-descriptions-files)) | |
917 | |
918 ;; Find new newsgroups and treat them. | |
919 (when (and init gnus-check-new-newsgroups (not level) | |
920 (gnus-check-server gnus-select-method) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
921 (not gnus-slave) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
922 gnus-plugged) |
17493 | 923 (gnus-find-new-newsgroups)) |
924 | |
925 ;; We might read in new NoCeM messages here. | |
926 (when (and gnus-use-nocem | |
927 (not level) | |
928 (not dont-connect)) | |
929 (gnus-nocem-scan-groups)) | |
930 | |
931 ;; Read any slave files. | |
932 (gnus-master-read-slave-newsrc) | |
933 | |
934 ;; Find the number of unread articles in each non-dead group. | |
935 (let ((gnus-read-active-file (and (not level) gnus-read-active-file))) | |
936 (gnus-get-unread-articles level)) | |
937 | |
938 (when (and init gnus-check-bogus-newsgroups | |
939 gnus-read-active-file (not level) | |
940 (gnus-server-opened gnus-select-method)) | |
941 (gnus-check-bogus-newsgroups)))) | |
942 | |
943 (defun gnus-find-new-newsgroups (&optional arg) | |
944 "Search for new newsgroups and add them. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
945 Each new newsgroup will be treated with `gnus-subscribe-newsgroup-method'. |
17493 | 946 The `-n' option line from .newsrc is respected. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
947 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
948 With 1 C-u, use the `ask-server' method to query the server for new |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
949 groups. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
950 With 2 C-u's, use most complete method possible to query the server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
951 for new groups, and subscribe the new groups as zombies." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
952 (interactive "p") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
953 (let* ((gnus-subscribe-newsgroup-method |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
954 gnus-subscribe-newsgroup-method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
955 (check (cond |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
956 ((or (and (= (or arg 1) 4) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
957 (not (listp gnus-check-new-newsgroups))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
958 (null gnus-read-active-file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
959 (eq gnus-read-active-file 'some)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
960 'ask-server) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
961 ((= (or arg 1) 16) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
962 (setq gnus-subscribe-newsgroup-method |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
963 'gnus-subscribe-zombies) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
964 t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
965 (t gnus-check-new-newsgroups)))) |
17493 | 966 (unless (gnus-check-first-time-used) |
967 (if (or (consp check) | |
968 (eq check 'ask-server)) | |
969 ;; Ask the server for new groups. | |
970 (gnus-ask-server-for-new-groups) | |
971 ;; Go through the active hashtb and look for new groups. | |
972 (let ((groups 0) | |
973 group new-newsgroups) | |
974 (gnus-message 5 "Looking for new newsgroups...") | |
975 (unless gnus-have-read-active-file | |
976 (gnus-read-active-file)) | |
38526
98b3bb015deb
(gnus-find-new-newsgroups): Use
Gerd Moellmann <gerd@gnu.org>
parents:
33396
diff
changeset
|
977 (setq gnus-newsrc-last-checked-date (message-make-date)) |
17493 | 978 (unless gnus-killed-hashtb |
979 (gnus-make-hashtable-from-killed)) | |
980 ;; Go though every newsgroup in `gnus-active-hashtb' and compare | |
981 ;; with `gnus-newsrc-hashtb' and `gnus-killed-hashtb'. | |
982 (mapatoms | |
983 (lambda (sym) | |
984 (if (or (null (setq group (symbol-name sym))) | |
985 (not (boundp sym)) | |
986 (null (symbol-value sym)) | |
987 (gnus-gethash group gnus-killed-hashtb) | |
988 (gnus-gethash group gnus-newsrc-hashtb)) | |
989 () | |
990 (let ((do-sub (gnus-matches-options-n group))) | |
991 (cond | |
992 ((eq do-sub 'subscribe) | |
993 (setq groups (1+ groups)) | |
994 (gnus-sethash group group gnus-killed-hashtb) | |
995 (funcall gnus-subscribe-options-newsgroup-method group)) | |
996 ((eq do-sub 'ignore) | |
997 nil) | |
998 (t | |
999 (setq groups (1+ groups)) | |
1000 (gnus-sethash group group gnus-killed-hashtb) | |
1001 (if gnus-subscribe-hierarchical-interactive | |
1002 (push group new-newsgroups) | |
1003 (funcall gnus-subscribe-newsgroup-method group))))))) | |
1004 gnus-active-hashtb) | |
1005 (when new-newsgroups | |
1006 (gnus-subscribe-hierarchical-interactive new-newsgroups)) | |
1007 (if (> groups 0) | |
1008 (gnus-message 5 "%d new newsgroup%s arrived." | |
1009 groups (if (> groups 1) "s have" " has")) | |
1010 (gnus-message 5 "No new newsgroups."))))))) | |
1011 | |
1012 (defun gnus-matches-options-n (group) | |
1013 ;; Returns `subscribe' if the group is to be unconditionally | |
1014 ;; subscribed, `ignore' if it is to be ignored, and nil if there is | |
1015 ;; no match for the group. | |
1016 | |
1017 ;; First we check the two user variables. | |
1018 (cond | |
1019 ((and gnus-options-subscribe | |
1020 (string-match gnus-options-subscribe group)) | |
1021 'subscribe) | |
1022 ((and gnus-auto-subscribed-groups | |
1023 (string-match gnus-auto-subscribed-groups group)) | |
1024 'subscribe) | |
1025 ((and gnus-options-not-subscribe | |
1026 (string-match gnus-options-not-subscribe group)) | |
1027 'ignore) | |
1028 ;; Then we go through the list that was retrieved from the .newsrc | |
1029 ;; file. This list has elements on the form | |
1030 ;; `(REGEXP . {ignore,subscribe})'. The first match found (the list | |
1031 ;; is in the reverse order of the options line) is returned. | |
1032 (t | |
1033 (let ((regs gnus-newsrc-options-n)) | |
1034 (while (and regs | |
1035 (not (string-match (caar regs) group))) | |
1036 (setq regs (cdr regs))) | |
1037 (and regs (cdar regs)))))) | |
1038 | |
1039 (defun gnus-ask-server-for-new-groups () | |
38526
98b3bb015deb
(gnus-find-new-newsgroups): Use
Gerd Moellmann <gerd@gnu.org>
parents:
33396
diff
changeset
|
1040 (let* ((new-date (message-make-date)) |
98b3bb015deb
(gnus-find-new-newsgroups): Use
Gerd Moellmann <gerd@gnu.org>
parents:
33396
diff
changeset
|
1041 (date (or gnus-newsrc-last-checked-date new-date)) |
17493 | 1042 (methods (cons gnus-select-method |
1043 (nconc | |
1044 (when (gnus-archive-server-wanted-p) | |
1045 (list "archive")) | |
1046 (append | |
1047 (and (consp gnus-check-new-newsgroups) | |
1048 gnus-check-new-newsgroups) | |
1049 gnus-secondary-select-methods)))) | |
1050 (groups 0) | |
1051 group new-newsgroups got-new method hashtb | |
1052 gnus-override-subscribe-method) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1053 (unless gnus-killed-hashtb |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1054 (gnus-make-hashtable-from-killed)) |
17493 | 1055 ;; Go through both primary and secondary select methods and |
1056 ;; request new newsgroups. | |
1057 (while (setq method (gnus-server-get-method nil (pop methods))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1058 (setq new-newsgroups nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1059 gnus-override-subscribe-method method) |
17493 | 1060 (when (and (gnus-check-server method) |
1061 (gnus-request-newgroups date method)) | |
1062 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1063 (setq got-new t |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1064 hashtb (gnus-make-hashtable 100)) |
17493 | 1065 (set-buffer nntp-server-buffer) |
1066 ;; Enter all the new groups into a hashtable. | |
1067 (gnus-active-to-gnus-format method hashtb 'ignore)) | |
1068 ;; Now all new groups from `method' are in `hashtb'. | |
1069 (mapatoms | |
1070 (lambda (group-sym) | |
1071 (if (or (null (setq group (symbol-name group-sym))) | |
1072 (not (boundp group-sym)) | |
1073 (null (symbol-value group-sym)) | |
1074 (gnus-gethash group gnus-newsrc-hashtb) | |
1075 (member group gnus-zombie-list) | |
1076 (member group gnus-killed-list)) | |
1077 ;; The group is already known. | |
1078 () | |
1079 ;; Make this group active. | |
1080 (when (symbol-value group-sym) | |
1081 (gnus-set-active group (symbol-value group-sym))) | |
1082 ;; Check whether we want it or not. | |
1083 (let ((do-sub (gnus-matches-options-n group))) | |
1084 (cond | |
1085 ((eq do-sub 'subscribe) | |
1086 (incf groups) | |
1087 (gnus-sethash group group gnus-killed-hashtb) | |
1088 (funcall gnus-subscribe-options-newsgroup-method group)) | |
1089 ((eq do-sub 'ignore) | |
1090 nil) | |
1091 (t | |
1092 (incf groups) | |
1093 (gnus-sethash group group gnus-killed-hashtb) | |
1094 (if gnus-subscribe-hierarchical-interactive | |
1095 (push group new-newsgroups) | |
1096 (funcall gnus-subscribe-newsgroup-method group))))))) | |
1097 hashtb)) | |
1098 (when new-newsgroups | |
1099 (gnus-subscribe-hierarchical-interactive new-newsgroups))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1100 (if (> groups 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1101 (gnus-message 5 "%d new newsgroup%s arrived" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1102 groups (if (> groups 1) "s have" " has")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1103 (gnus-message 5 "No new newsgroups")) |
17493 | 1104 (when got-new |
1105 (setq gnus-newsrc-last-checked-date new-date)) | |
1106 got-new)) | |
1107 | |
1108 (defun gnus-check-first-time-used () | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1109 (catch 'ended |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1110 ;; First check if any of the following files exist. If they do, |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1111 ;; it's not the first time the user has used Gnus. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1112 (dolist (file (list gnus-current-startup-file |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1113 (concat gnus-current-startup-file ".el") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1114 (concat gnus-current-startup-file ".eld") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1115 gnus-startup-file |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1116 (concat gnus-startup-file ".el") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1117 (concat gnus-startup-file ".eld"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1118 (when (file-exists-p file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1119 (throw 'ended nil))) |
17493 | 1120 (gnus-message 6 "First time user; subscribing you to default groups") |
1121 (unless (gnus-read-active-file-p) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1122 (let ((gnus-read-active-file t)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1123 (gnus-read-active-file))) |
38526
98b3bb015deb
(gnus-find-new-newsgroups): Use
Gerd Moellmann <gerd@gnu.org>
parents:
33396
diff
changeset
|
1124 (setq gnus-newsrc-last-checked-date (message-make-date)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1125 ;; Subscribe to the default newsgroups. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1126 (let ((groups (or gnus-default-subscribed-newsgroups |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1127 gnus-backup-default-subscribed-newsgroups)) |
17493 | 1128 group) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1129 (when (eq groups t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1130 ;; If t, we subscribe (or not) all groups as if they were new. |
17493 | 1131 (mapatoms |
1132 (lambda (sym) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1133 (when (setq group (symbol-name sym)) |
17493 | 1134 (let ((do-sub (gnus-matches-options-n group))) |
1135 (cond | |
1136 ((eq do-sub 'subscribe) | |
1137 (gnus-sethash group group gnus-killed-hashtb) | |
1138 (funcall gnus-subscribe-options-newsgroup-method group)) | |
1139 ((eq do-sub 'ignore) | |
1140 nil) | |
1141 (t | |
1142 (push group gnus-killed-list)))))) | |
1143 gnus-active-hashtb) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1144 (dolist (group groups) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1145 ;; Only subscribe the default groups that are activated. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1146 (when (gnus-active group) |
17493 | 1147 (gnus-group-change-level |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1148 group gnus-level-default-subscribed gnus-level-killed))) |
23103 | 1149 (save-excursion |
1150 (set-buffer gnus-group-buffer) | |
1151 (gnus-group-make-help-group)) | |
17493 | 1152 (when gnus-novice-user |
1153 (gnus-message 7 "`A k' to list killed groups")))))) | |
1154 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1155 (defun gnus-subscribe-group (group &optional previous method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1156 "Subcribe GROUP and put it after PREVIOUS." |
17493 | 1157 (gnus-group-change-level |
1158 (if method | |
1159 (list t group gnus-level-default-subscribed nil nil method) | |
1160 group) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1161 gnus-level-default-subscribed gnus-level-killed previous t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1162 t) |
17493 | 1163 |
1164 ;; `gnus-group-change-level' is the fundamental function for changing | |
1165 ;; subscription levels of newsgroups. This might mean just changing | |
1166 ;; from level 1 to 2, which is pretty trivial, from 2 to 6 or back | |
1167 ;; again, which subscribes/unsubscribes a group, which is equally | |
1168 ;; trivial. Changing from 1-7 to 8-9 means that you kill a group, and | |
1169 ;; from 8-9 to 1-7 means that you remove the group from the list of | |
1170 ;; killed (or zombie) groups and add them to the (kinda) subscribed | |
1171 ;; groups. And last but not least, moving from 8 to 9 and 9 to 8, | |
1172 ;; which is trivial. | |
1173 ;; ENTRY can either be a string (newsgroup name) or a list (if | |
1174 ;; FROMKILLED is t, it's a list on the format (NUM INFO-LIST), | |
1175 ;; otherwise it's a list in the format of the `gnus-newsrc-hashtb' | |
1176 ;; entries. | |
1177 ;; LEVEL is the new level of the group, OLDLEVEL is the old level and | |
1178 ;; PREVIOUS is the group (in hashtb entry format) to insert this group | |
1179 ;; after. | |
1180 (defun gnus-group-change-level (entry level &optional oldlevel | |
1181 previous fromkilled) | |
1182 (let (group info active num) | |
1183 ;; Glean what info we can from the arguments | |
1184 (if (consp entry) | |
1185 (if fromkilled (setq group (nth 1 entry)) | |
1186 (setq group (car (nth 2 entry)))) | |
1187 (setq group entry)) | |
1188 (when (and (stringp entry) | |
1189 oldlevel | |
1190 (< oldlevel gnus-level-zombie)) | |
1191 (setq entry (gnus-gethash entry gnus-newsrc-hashtb))) | |
1192 (if (and (not oldlevel) | |
1193 (consp entry)) | |
1194 (setq oldlevel (gnus-info-level (nth 2 entry))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1195 (setq oldlevel (or oldlevel gnus-level-killed))) |
17493 | 1196 (when (stringp previous) |
1197 (setq previous (gnus-gethash previous gnus-newsrc-hashtb))) | |
1198 | |
1199 (if (and (>= oldlevel gnus-level-zombie) | |
1200 (gnus-gethash group gnus-newsrc-hashtb)) | |
1201 ;; We are trying to subscribe a group that is already | |
1202 ;; subscribed. | |
1203 () ; Do nothing. | |
1204 | |
1205 (unless (gnus-ephemeral-group-p group) | |
1206 (gnus-dribble-enter | |
1207 (format "(gnus-group-change-level %S %S %S %S %S)" | |
1208 group level oldlevel (car (nth 2 previous)) fromkilled))) | |
1209 | |
1210 ;; Then we remove the newgroup from any old structures, if needed. | |
1211 ;; If the group was killed, we remove it from the killed or zombie | |
1212 ;; list. If not, and it is in fact going to be killed, we remove | |
1213 ;; it from the newsrc hash table and assoc. | |
1214 (cond | |
1215 ((>= oldlevel gnus-level-zombie) | |
1216 (if (= oldlevel gnus-level-zombie) | |
1217 (setq gnus-zombie-list (delete group gnus-zombie-list)) | |
1218 (setq gnus-killed-list (delete group gnus-killed-list)))) | |
1219 (t | |
1220 (when (and (>= level gnus-level-zombie) | |
1221 entry) | |
1222 (gnus-sethash (car (nth 2 entry)) nil gnus-newsrc-hashtb) | |
1223 (when (nth 3 entry) | |
1224 (setcdr (gnus-gethash (car (nth 3 entry)) | |
1225 gnus-newsrc-hashtb) | |
1226 (cdr entry))) | |
1227 (setcdr (cdr entry) (cdddr entry))))) | |
1228 | |
1229 ;; Finally we enter (if needed) the list where it is supposed to | |
1230 ;; go, and change the subscription level. If it is to be killed, | |
1231 ;; we enter it into the killed or zombie list. | |
1232 (cond | |
1233 ((>= level gnus-level-zombie) | |
1234 ;; Remove from the hash table. | |
1235 (gnus-sethash group nil gnus-newsrc-hashtb) | |
1236 ;; We do not enter foreign groups into the list of dead | |
1237 ;; groups. | |
1238 (unless (gnus-group-foreign-p group) | |
1239 (if (= level gnus-level-zombie) | |
1240 (push group gnus-zombie-list) | |
1241 (push group gnus-killed-list)))) | |
1242 (t | |
1243 ;; If the list is to be entered into the newsrc assoc, and | |
1244 ;; it was killed, we have to create an entry in the newsrc | |
1245 ;; hashtb format and fix the pointers in the newsrc assoc. | |
1246 (if (< oldlevel gnus-level-zombie) | |
1247 ;; It was alive, and it is going to stay alive, so we | |
1248 ;; just change the level and don't change any pointers or | |
1249 ;; hash table entries. | |
1250 (setcar (cdaddr entry) level) | |
1251 (if (listp entry) | |
1252 (setq info (cdr entry) | |
1253 num (car entry)) | |
1254 (setq active (gnus-active group)) | |
1255 (setq num | |
1256 (if active (- (1+ (cdr active)) (car active)) t)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1257 ;; Shorten the select method if possible, if we need to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1258 ;; store it at all (native groups). |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1259 (let ((method (gnus-method-simplify |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1260 (or gnus-override-subscribe-method |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1261 (gnus-group-method group))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1262 (if method |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1263 (setq info (list group level nil nil method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1264 (setq info (list group level nil))))) |
17493 | 1265 (unless previous |
1266 (setq previous | |
1267 (let ((p gnus-newsrc-alist)) | |
1268 (while (cddr p) | |
1269 (setq p (cdr p))) | |
1270 p))) | |
1271 (setq entry (cons info (cddr previous))) | |
1272 (if (cdr previous) | |
1273 (progn | |
1274 (setcdr (cdr previous) entry) | |
1275 (gnus-sethash group (cons num (cdr previous)) | |
1276 gnus-newsrc-hashtb)) | |
1277 (setcdr previous entry) | |
1278 (gnus-sethash group (cons num previous) | |
1279 gnus-newsrc-hashtb)) | |
1280 (when (cdr entry) | |
1281 (setcdr (gnus-gethash (caadr entry) gnus-newsrc-hashtb) entry)) | |
1282 (gnus-dribble-enter | |
1283 (format | |
1284 "(gnus-group-set-info '%S)" info))))) | |
1285 (when gnus-group-change-level-function | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1286 (funcall gnus-group-change-level-function |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1287 group level oldlevel previous))))) |
17493 | 1288 |
1289 (defun gnus-kill-newsgroup (newsgroup) | |
1290 "Obsolete function. Kills a newsgroup." | |
1291 (gnus-group-change-level | |
1292 (gnus-gethash newsgroup gnus-newsrc-hashtb) gnus-level-killed)) | |
1293 | |
1294 (defun gnus-check-bogus-newsgroups (&optional confirm) | |
1295 "Remove bogus newsgroups. | |
1296 If CONFIRM is non-nil, the user has to confirm the deletion of every | |
1297 newsgroup." | |
1298 (let ((newsrc (cdr gnus-newsrc-alist)) | |
1299 bogus group entry info) | |
1300 (gnus-message 5 "Checking bogus newsgroups...") | |
1301 (unless (gnus-read-active-file-p) | |
1302 (gnus-read-active-file t)) | |
1303 (when (gnus-read-active-file-p) | |
1304 ;; Find all bogus newsgroup that are subscribed. | |
1305 (while newsrc | |
1306 (setq info (pop newsrc) | |
1307 group (gnus-info-group info)) | |
1308 (unless (or (gnus-active group) ; Active | |
1309 (gnus-info-method info)) ; Foreign | |
1310 ;; Found a bogus newsgroup. | |
1311 (push group bogus))) | |
1312 (if confirm | |
1313 (map-y-or-n-p | |
1314 "Remove bogus group %s? " | |
1315 (lambda (group) | |
1316 ;; Remove all bogus subscribed groups by first killing them, and | |
1317 ;; then removing them from the list of killed groups. | |
1318 (when (setq entry (gnus-gethash group gnus-newsrc-hashtb)) | |
1319 (gnus-group-change-level entry gnus-level-killed) | |
1320 (setq gnus-killed-list (delete group gnus-killed-list)))) | |
1321 bogus '("group" "groups" "remove")) | |
1322 (while (setq group (pop bogus)) | |
1323 ;; Remove all bogus subscribed groups by first killing them, and | |
1324 ;; then removing them from the list of killed groups. | |
1325 (when (setq entry (gnus-gethash group gnus-newsrc-hashtb)) | |
1326 (gnus-group-change-level entry gnus-level-killed) | |
1327 (setq gnus-killed-list (delete group gnus-killed-list))))) | |
1328 ;; Then we remove all bogus groups from the list of killed and | |
1329 ;; zombie groups. They are removed without confirmation. | |
1330 (let ((dead-lists '(gnus-killed-list gnus-zombie-list)) | |
1331 killed) | |
1332 (while dead-lists | |
1333 (setq killed (symbol-value (car dead-lists))) | |
1334 (while killed | |
1335 (unless (gnus-active (setq group (pop killed))) | |
1336 ;; The group is bogus. | |
1337 ;; !!!Slow as hell. | |
1338 (set (car dead-lists) | |
1339 (delete group (symbol-value (car dead-lists)))))) | |
1340 (setq dead-lists (cdr dead-lists)))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1341 (gnus-run-hooks 'gnus-check-bogus-groups-hook) |
17493 | 1342 (gnus-message 5 "Checking bogus newsgroups...done")))) |
1343 | |
1344 (defun gnus-check-duplicate-killed-groups () | |
1345 "Remove duplicates from the list of killed groups." | |
1346 (interactive) | |
1347 (let ((killed gnus-killed-list)) | |
1348 (while killed | |
1349 (gnus-message 9 "%d" (length killed)) | |
1350 (setcdr killed (delete (car killed) (cdr killed))) | |
1351 (setq killed (cdr killed))))) | |
1352 | |
1353 ;; We want to inline a function from gnus-cache, so we cheat here: | |
1354 (eval-when-compile | |
1355 (defvar gnus-cache-active-hashtb) | |
1356 (defun gnus-cache-possibly-alter-active (group active) | |
1357 "Alter the ACTIVE info for GROUP to reflect the articles in the cache." | |
1358 (when gnus-cache-active-hashtb | |
1359 (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1360 (when cache-active |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1361 (when (< (car cache-active) (car active)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1362 (setcar active (car cache-active))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1363 (when (> (cdr cache-active) (cdr active)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1364 (setcdr active (cdr cache-active)))))))) |
17493 | 1365 |
1366 (defun gnus-activate-group (group &optional scan dont-check method) | |
1367 ;; Check whether a group has been activated or not. | |
1368 ;; If SCAN, request a scan of that group as well. | |
1369 (let ((method (or method (inline (gnus-find-method-for-group group)))) | |
1370 active) | |
1371 (and (inline (gnus-check-server method)) | |
1372 ;; We escape all bugs and quit here to make it possible to | |
1373 ;; continue if a group is so out-there that it reports bugs | |
1374 ;; and stuff. | |
1375 (progn | |
1376 (and scan | |
1377 (gnus-check-backend-function 'request-scan (car method)) | |
1378 (gnus-request-scan group method)) | |
1379 t) | |
1380 (condition-case () | |
1381 (inline (gnus-request-group group dont-check method)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1382 ;;(error nil) |
33327
6b5904398ffd
2000-11-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
Dave Love <fx@gnu.org>
parents:
32939
diff
changeset
|
1383 (quit |
6b5904398ffd
2000-11-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
Dave Love <fx@gnu.org>
parents:
32939
diff
changeset
|
1384 (message "Quit activating %s" group) |
6b5904398ffd
2000-11-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
Dave Love <fx@gnu.org>
parents:
32939
diff
changeset
|
1385 nil)) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1386 (setq active (gnus-parse-active)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1387 ;; If there are no articles in the group, the GROUP |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1388 ;; command may have responded with the `(0 . 0)'. We |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1389 ;; ignore this if we already have an active entry |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1390 ;; for the group. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1391 (if (and (zerop (car active)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1392 (zerop (cdr active)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1393 (gnus-active group)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1394 (gnus-active group) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1395 (gnus-set-active group active) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1396 ;; Return the new active info. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1397 active)))) |
17493 | 1398 |
1399 (defun gnus-get-unread-articles-in-group (info active &optional update) | |
1400 (when active | |
1401 ;; Allow the backend to update the info in the group. | |
1402 (when (and update | |
1403 (gnus-request-update-info | |
1404 info (inline (gnus-find-method-for-group | |
1405 (gnus-info-group info))))) | |
1406 (gnus-activate-group (gnus-info-group info) nil t)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1407 |
17493 | 1408 (let* ((range (gnus-info-read info)) |
1409 (num 0)) | |
1410 ;; If a cache is present, we may have to alter the active info. | |
1411 (when (and gnus-use-cache info) | |
1412 (inline (gnus-cache-possibly-alter-active | |
1413 (gnus-info-group info) active))) | |
1414 ;; Modify the list of read articles according to what articles | |
1415 ;; are available; then tally the unread articles and add the | |
1416 ;; number to the group hash table entry. | |
1417 (cond | |
1418 ((zerop (cdr active)) | |
1419 (setq num 0)) | |
1420 ((not range) | |
1421 (setq num (- (1+ (cdr active)) (car active)))) | |
1422 ((not (listp (cdr range))) | |
1423 ;; Fix a single (num . num) range according to the | |
1424 ;; active hash table. | |
1425 ;; Fix by Carsten Bormann <cabo@Informatik.Uni-Bremen.DE>. | |
1426 (and (< (cdr range) (car active)) (setcdr range (1- (car active)))) | |
1427 (and (> (cdr range) (cdr active)) (setcdr range (cdr active))) | |
1428 ;; Compute number of unread articles. | |
1429 (setq num (max 0 (- (cdr active) (- (1+ (cdr range)) (car range)))))) | |
1430 (t | |
1431 ;; The read list is a list of ranges. Fix them according to | |
1432 ;; the active hash table. | |
1433 ;; First peel off any elements that are below the lower | |
1434 ;; active limit. | |
1435 (while (and (cdr range) | |
1436 (>= (car active) | |
1437 (or (and (atom (cadr range)) (cadr range)) | |
1438 (caadr range)))) | |
1439 (if (numberp (car range)) | |
1440 (setcar range | |
1441 (cons (car range) | |
1442 (or (and (numberp (cadr range)) | |
1443 (cadr range)) | |
1444 (cdadr range)))) | |
1445 (setcdr (car range) | |
1446 (or (and (numberp (nth 1 range)) (nth 1 range)) | |
1447 (cdadr range)))) | |
1448 (setcdr range (cddr range))) | |
1449 ;; Adjust the first element to be the same as the lower limit. | |
1450 (when (and (not (atom (car range))) | |
1451 (< (cdar range) (car active))) | |
1452 (setcdr (car range) (1- (car active)))) | |
1453 ;; Then we want to peel off any elements that are higher | |
1454 ;; than the upper active limit. | |
1455 (let ((srange range)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1456 ;; Go past all valid elements. |
17493 | 1457 (while (and (cdr srange) |
1458 (<= (or (and (atom (cadr srange)) | |
1459 (cadr srange)) | |
1460 (caadr srange)) | |
1461 (cdr active))) | |
1462 (setq srange (cdr srange))) | |
1463 (when (cdr srange) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1464 ;; Nuke all remaining invalid elements. |
17493 | 1465 (setcdr srange nil)) |
1466 | |
1467 ;; Adjust the final element. | |
1468 (when (and (not (atom (car srange))) | |
1469 (> (cdar srange) (cdr active))) | |
1470 (setcdr (car srange) (cdr active)))) | |
1471 ;; Compute the number of unread articles. | |
1472 (while range | |
1473 (setq num (+ num (- (1+ (or (and (atom (car range)) (car range)) | |
1474 (cdar range))) | |
1475 (or (and (atom (car range)) (car range)) | |
1476 (caar range))))) | |
1477 (setq range (cdr range))) | |
1478 (setq num (max 0 (- (cdr active) num))))) | |
1479 ;; Set the number of unread articles. | |
1480 (when info | |
1481 (setcar (gnus-gethash (gnus-info-group info) gnus-newsrc-hashtb) num)) | |
1482 num))) | |
1483 | |
1484 ;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb' | |
1485 ;; and compute how many unread articles there are in each group. | |
1486 (defun gnus-get-unread-articles (&optional level) | |
1487 (let* ((newsrc (cdr gnus-newsrc-alist)) | |
1488 (level (or level gnus-activate-level (1+ gnus-level-subscribed))) | |
1489 (foreign-level | |
1490 (min | |
1491 (cond ((and gnus-activate-foreign-newsgroups | |
1492 (not (numberp gnus-activate-foreign-newsgroups))) | |
1493 (1+ gnus-level-subscribed)) | |
1494 ((numberp gnus-activate-foreign-newsgroups) | |
1495 gnus-activate-foreign-newsgroups) | |
1496 (t 0)) | |
1497 level)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1498 scanned-methods info group active method retrievegroups) |
17493 | 1499 (gnus-message 5 "Checking new news...") |
1500 | |
1501 (while newsrc | |
1502 (setq active (gnus-active (setq group (gnus-info-group | |
1503 (setq info (pop newsrc)))))) | |
1504 | |
1505 ;; Check newsgroups. If the user doesn't want to check them, or | |
1506 ;; they can't be checked (for instance, if the news server can't | |
1507 ;; be reached) we just set the number of unread articles in this | |
1508 ;; newsgroup to t. This means that Gnus thinks that there are | |
1509 ;; unread articles, but it has no idea how many. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1510 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1511 ;; To be more explicit: |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1512 ;; >0 for an active group with messages |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1513 ;; 0 for an active group with no unread messages |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1514 ;; nil for non-foreign groups that the user has requested not be checked |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1515 ;; t for unchecked foreign groups or bogus groups, or groups that can't |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1516 ;; be checked, for one reason or other. |
17493 | 1517 (if (and (setq method (gnus-info-method info)) |
1518 (not (inline | |
1519 (gnus-server-equal | |
1520 gnus-select-method | |
1521 (setq method (gnus-server-get-method nil method))))) | |
1522 (not (gnus-secondary-method-p method))) | |
1523 ;; These groups are foreign. Check the level. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1524 (when (and (<= (gnus-info-level info) foreign-level) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1525 (setq active (gnus-activate-group group 'scan))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1526 ;; Let the Gnus agent save the active file. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1527 (when (and gnus-agent gnus-plugged active) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1528 (gnus-agent-save-group-info |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1529 method (gnus-group-real-name group) active)) |
17493 | 1530 (unless (inline (gnus-virtual-group-p group)) |
1531 (inline (gnus-close-group group))) | |
1532 (when (fboundp (intern (concat (symbol-name (car method)) | |
1533 "-request-update-info"))) | |
1534 (inline (gnus-request-update-info info method)))) | |
1535 ;; These groups are native or secondary. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1536 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1537 ;; We don't want these groups. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1538 ((> (gnus-info-level info) level) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1539 (setq active 'ignore)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1540 ;; Activate groups. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1541 ((not gnus-read-active-file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1542 (if (gnus-check-backend-function 'retrieve-groups group) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1543 ;; if server support gnus-retrieve-groups we push |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1544 ;; the group onto retrievegroups for later checking |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1545 (if (assoc method retrievegroups) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1546 (setcdr (assoc method retrievegroups) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1547 (cons group (cdr (assoc method retrievegroups)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1548 (push (list method group) retrievegroups)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1549 ;; hack: `nnmail-get-new-mail' changes the mail-source depending |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1550 ;; on the group, so we must perform a scan for every group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1551 ;; if the users has any directory mail sources. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1552 ;; hack: if `nnmail-scan-directory-mail-source-once' is non-nil, |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1553 ;; for it scan all spool files even when the groups are |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1554 ;; not required. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1555 (if (and |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1556 (or nnmail-scan-directory-mail-source-once |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1557 (null (assq 'directory |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1558 (or mail-sources |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1559 (if (listp nnmail-spool-file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1560 nnmail-spool-file |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1561 (list nnmail-spool-file)))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1562 (member method scanned-methods)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1563 (setq active (gnus-activate-group group)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1564 (setq active (gnus-activate-group group 'scan)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1565 (push method scanned-methods)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1566 (when active |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1567 (gnus-close-group group)))))) |
17493 | 1568 |
1569 ;; Get the number of unread articles in the group. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1570 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1571 ((eq active 'ignore) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1572 ;; Don't do anything. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1573 ) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1574 (active |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1575 (inline (gnus-get-unread-articles-in-group info active t))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1576 (t |
17493 | 1577 ;; The group couldn't be reached, so we nix out the number of |
1578 ;; unread articles and stuff. | |
1579 (gnus-set-active group nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1580 (let ((tmp (gnus-gethash group gnus-newsrc-hashtb))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1581 (if tmp (setcar tmp t)))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1582 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1583 ;; iterate through groups on methods which support gnus-retrieve-groups |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1584 ;; and fetch a partial active file and use it to find new news. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1585 (while retrievegroups |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1586 (let* ((mg (pop retrievegroups)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1587 (method (or (car mg) gnus-select-method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1588 (groups (cdr mg))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1589 (when (gnus-check-server method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1590 ;; Request that the backend scan its incoming messages. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1591 (when (gnus-check-backend-function 'request-scan (car method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1592 (gnus-request-scan nil method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1593 (gnus-read-active-file-2 (mapcar (lambda (group) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1594 (gnus-group-real-name group)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1595 groups) method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1596 (dolist (group groups) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1597 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1598 ((setq active (gnus-active (gnus-info-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1599 (setq info (gnus-get-info group))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1600 (inline (gnus-get-unread-articles-in-group info active t))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1601 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1602 ;; The group couldn't be reached, so we nix out the number of |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1603 ;; unread articles and stuff. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1604 (gnus-set-active group nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1605 (setcar (gnus-gethash group gnus-newsrc-hashtb) t))))))) |
17493 | 1606 |
1607 (gnus-message 5 "Checking new news...done"))) | |
1608 | |
1609 ;; Create a hash table out of the newsrc alist. The `car's of the | |
1610 ;; alist elements are used as keys. | |
1611 (defun gnus-make-hashtable-from-newsrc-alist () | |
1612 (let ((alist gnus-newsrc-alist) | |
1613 (ohashtb gnus-newsrc-hashtb) | |
1614 prev) | |
1615 (setq gnus-newsrc-hashtb (gnus-make-hashtable (length alist))) | |
1616 (setq alist | |
1617 (setq prev (setq gnus-newsrc-alist | |
1618 (if (equal (caar gnus-newsrc-alist) | |
1619 "dummy.group") | |
1620 gnus-newsrc-alist | |
1621 (cons (list "dummy.group" 0 nil) alist))))) | |
1622 (while alist | |
1623 (gnus-sethash | |
1624 (caar alist) | |
1625 ;; Preserve number of unread articles in groups. | |
1626 (cons (and ohashtb (car (gnus-gethash (caar alist) ohashtb))) | |
1627 prev) | |
1628 gnus-newsrc-hashtb) | |
1629 (setq prev alist | |
1630 alist (cdr alist))))) | |
1631 | |
1632 (defun gnus-make-hashtable-from-killed () | |
1633 "Create a hash table from the killed and zombie lists." | |
1634 (let ((lists '(gnus-killed-list gnus-zombie-list)) | |
1635 list) | |
1636 (setq gnus-killed-hashtb | |
1637 (gnus-make-hashtable | |
1638 (+ (length gnus-killed-list) (length gnus-zombie-list)))) | |
1639 (while lists | |
1640 (setq list (symbol-value (pop lists))) | |
1641 (while list | |
1642 (gnus-sethash (car list) (pop list) gnus-killed-hashtb))))) | |
1643 | |
1644 (defun gnus-parse-active () | |
1645 "Parse active info in the nntp server buffer." | |
1646 (save-excursion | |
1647 (set-buffer nntp-server-buffer) | |
1648 (goto-char (point-min)) | |
1649 ;; Parse the result we got from `gnus-request-group'. | |
1650 (when (looking-at "[0-9]+ [0-9]+ \\([0-9]+\\) [0-9]+") | |
1651 (goto-char (match-beginning 1)) | |
1652 (cons (read (current-buffer)) | |
1653 (read (current-buffer)))))) | |
1654 | |
1655 (defun gnus-make-articles-unread (group articles) | |
1656 "Mark ARTICLES in GROUP as unread." | |
1657 (let* ((info (nth 2 (or (gnus-gethash group gnus-newsrc-hashtb) | |
1658 (gnus-gethash (gnus-group-real-name group) | |
1659 gnus-newsrc-hashtb)))) | |
1660 (ranges (gnus-info-read info)) | |
1661 news article) | |
1662 (while articles | |
1663 (when (gnus-member-of-range | |
1664 (setq article (pop articles)) ranges) | |
1665 (push article news))) | |
1666 (when news | |
1667 (gnus-info-set-read | |
1668 info (gnus-remove-from-range (gnus-info-read info) (nreverse news))) | |
1669 (gnus-group-update-group group t)))) | |
1670 | |
1671 ;; Enter all dead groups into the hashtb. | |
1672 (defun gnus-update-active-hashtb-from-killed () | |
1673 (let ((hashtb (setq gnus-active-hashtb (gnus-make-hashtable 4096))) | |
1674 (lists (list gnus-killed-list gnus-zombie-list)) | |
1675 killed) | |
1676 (while lists | |
1677 (setq killed (car lists)) | |
1678 (while killed | |
1679 (gnus-sethash (car killed) nil hashtb) | |
1680 (setq killed (cdr killed))) | |
1681 (setq lists (cdr lists))))) | |
1682 | |
1683 (defun gnus-get-killed-groups () | |
1684 "Go through the active hashtb and mark all unknown groups as killed." | |
1685 ;; First make sure active file has been read. | |
1686 (unless (gnus-read-active-file-p) | |
1687 (let ((gnus-read-active-file t)) | |
1688 (gnus-read-active-file))) | |
1689 (unless gnus-killed-hashtb | |
1690 (gnus-make-hashtable-from-killed)) | |
1691 ;; Go through all newsgroups that are known to Gnus - enlarge kill list. | |
1692 (mapatoms | |
1693 (lambda (sym) | |
1694 (let ((groups 0) | |
1695 (group (symbol-name sym))) | |
1696 (if (or (null group) | |
1697 (gnus-gethash group gnus-killed-hashtb) | |
1698 (gnus-gethash group gnus-newsrc-hashtb)) | |
1699 () | |
1700 (let ((do-sub (gnus-matches-options-n group))) | |
1701 (if (or (eq do-sub 'subscribe) (eq do-sub 'ignore)) | |
1702 () | |
1703 (setq groups (1+ groups)) | |
1704 (push group gnus-killed-list) | |
1705 (gnus-sethash group group gnus-killed-hashtb)))))) | |
1706 gnus-active-hashtb) | |
1707 (gnus-dribble-touch)) | |
1708 | |
1709 ;; Get the active file(s) from the backend(s). | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1710 (defun gnus-read-active-file (&optional force not-native) |
17493 | 1711 (gnus-group-set-mode-line) |
1712 (let ((methods | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1713 (mapcar |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1714 (lambda (m) (if (stringp m) (gnus-server-get-method nil m) m)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1715 (append |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1716 (if (and (not not-native) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1717 (gnus-check-server gnus-select-method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1718 ;; The native server is available. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1719 (cons gnus-select-method gnus-secondary-select-methods) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1720 ;; The native server is down, so we just do the |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1721 ;; secondary ones. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1722 gnus-secondary-select-methods) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1723 ;; Also read from the archive server. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1724 (when (gnus-archive-server-wanted-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1725 (list "archive"))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1726 method) |
17493 | 1727 (setq gnus-have-read-active-file nil) |
1728 (save-excursion | |
1729 (set-buffer nntp-server-buffer) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1730 (while (setq method (pop methods)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1731 ;; Only do each method once, in case the methods appear more |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1732 ;; than once in this list. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1733 (unless (member method methods) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1734 (condition-case () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1735 (gnus-read-active-file-1 method force) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1736 ;; We catch C-g so that we can continue past servers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1737 ;; that do not respond. |
33327
6b5904398ffd
2000-11-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
Dave Love <fx@gnu.org>
parents:
32939
diff
changeset
|
1738 (quit |
6b5904398ffd
2000-11-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
Dave Love <fx@gnu.org>
parents:
32939
diff
changeset
|
1739 (message "Quit reading the active file") |
6b5904398ffd
2000-11-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
Dave Love <fx@gnu.org>
parents:
32939
diff
changeset
|
1740 nil))))))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1741 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1742 (defun gnus-read-active-file-1 (method force) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1743 (let (where mesg) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1744 (setq where (nth 1 method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1745 mesg (format "Reading active file%s via %s..." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1746 (if (and where (not (zerop (length where)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1747 (concat " from " where) "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1748 (car method))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1749 (gnus-message 5 mesg) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1750 (when (gnus-check-server method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1751 ;; Request that the backend scan its incoming messages. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1752 (when (gnus-check-backend-function 'request-scan (car method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1753 (gnus-request-scan nil method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1754 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1755 ((and (eq gnus-read-active-file 'some) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1756 (gnus-check-backend-function 'retrieve-groups (car method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1757 (not force)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1758 (let ((newsrc (cdr gnus-newsrc-alist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1759 (gmethod (gnus-server-get-method nil method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1760 groups info) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1761 (while (setq info (pop newsrc)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1762 (when (inline |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1763 (gnus-server-equal |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1764 (inline |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1765 (gnus-find-method-for-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1766 (gnus-info-group info) info)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1767 gmethod)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1768 (push (gnus-group-real-name (gnus-info-group info)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1769 groups))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1770 (gnus-read-active-file-2 groups method))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1771 ((null method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1772 t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1773 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1774 (if (not (gnus-request-list method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1775 (unless (equal method gnus-message-archive-method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1776 (gnus-error 1 "Cannot read active file from %s server" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1777 (car method))) |
17493 | 1778 (gnus-message 5 mesg) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1779 (gnus-active-to-gnus-format method gnus-active-hashtb nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1780 ;; We mark this active file as read. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1781 (push method gnus-have-read-active-file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1782 (gnus-message 5 "%sdone" mesg))))))) |
17493 | 1783 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1784 (defun gnus-read-active-file-2 (groups method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1785 "Read an active file for GROUPS in METHOD using gnus-retrieve-groups." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1786 (when groups |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1787 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1788 (set-buffer nntp-server-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1789 (gnus-check-server method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1790 (let ((list-type (gnus-retrieve-groups groups method))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1791 (cond ((not list-type) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1792 (gnus-error |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1793 1.2 "Cannot read partial active file from %s server." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1794 (car method))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1795 ((eq list-type 'active) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1796 (gnus-active-to-gnus-format method gnus-active-hashtb nil t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1797 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1798 (gnus-groups-to-gnus-format method gnus-active-hashtb t))))))) |
17493 | 1799 |
1800 ;; Read an active file and place the results in `gnus-active-hashtb'. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1801 (defun gnus-active-to-gnus-format (&optional method hashtb ignore-errors |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1802 real-active) |
17493 | 1803 (unless method |
1804 (setq method gnus-select-method)) | |
1805 (let ((cur (current-buffer)) | |
1806 (hashtb (or hashtb | |
1807 (if (and gnus-active-hashtb | |
1808 (not (equal method gnus-select-method))) | |
1809 gnus-active-hashtb | |
1810 (setq gnus-active-hashtb | |
1811 (if (equal method gnus-select-method) | |
1812 (gnus-make-hashtable | |
1813 (count-lines (point-min) (point-max))) | |
1814 (gnus-make-hashtable 4096))))))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1815 ;; Delete unnecessary lines. |
17493 | 1816 (goto-char (point-min)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1817 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1818 ((string= gnus-ignored-newsgroups "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1819 (delete-matching-lines "^to\\.")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1820 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1821 (delete-matching-lines (concat "^to\\.\\|" gnus-ignored-newsgroups)))) |
17493 | 1822 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1823 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1824 (unless (re-search-forward "[\\\"]" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1825 ;; Make the group names readable as a lisp expression even if they |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1826 ;; contain special characters. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1827 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1828 (while (re-search-backward "[][';?()#]" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1829 (insert ?\\))) |
17493 | 1830 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1831 ;; Let the Gnus agent save the active file. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1832 (when (and gnus-agent real-active gnus-plugged) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1833 (gnus-agent-save-active method)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1834 |
17493 | 1835 ;; If these are groups from a foreign select method, we insert the |
1836 ;; group prefix in front of the group names. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1837 (when (not (gnus-server-equal |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1838 (gnus-server-get-method nil method) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1839 (gnus-server-get-method nil gnus-select-method))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1840 (let ((prefix (gnus-group-prefixed-name "" method))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1841 (goto-char (point-min)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
1842 (while (and (not (eobp)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1843 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1844 (when (= (following-char) ?\") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1845 (forward-char 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1846 (insert prefix) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1847 (zerop (forward-line 1))))))) |
17493 | 1848 ;; Store the active file in a hash table. |
1849 (goto-char (point-min)) | |
1850 (let (group max min) | |
1851 (while (not (eobp)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1852 (condition-case err |
17493 | 1853 (progn |
1854 (narrow-to-region (point) (gnus-point-at-eol)) | |
1855 ;; group gets set to a symbol interned in the hash table | |
1856 ;; (what a hack!!) - jwz | |
1857 (setq group (let ((obarray hashtb)) (read cur))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1858 ;; ### The extended group name scheme makes |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1859 ;; the previous optimization strategy sort of pointless... |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1860 (when (stringp group) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1861 (setq group (intern group hashtb))) |
17493 | 1862 (if (and (numberp (setq max (read cur))) |
1863 (numberp (setq min (read cur))) | |
1864 (progn | |
1865 (skip-chars-forward " \t") | |
1866 (not | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1867 (or (eq (char-after) ?=) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1868 (eq (char-after) ?x) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1869 (eq (char-after) ?j))))) |
17493 | 1870 (progn |
1871 (set group (cons min max)) | |
1872 ;; if group is moderated, stick in moderation table | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1873 (when (eq (char-after) ?m) |
17493 | 1874 (unless gnus-moderated-hashtb |
1875 (setq gnus-moderated-hashtb (gnus-make-hashtable))) | |
1876 (gnus-sethash (symbol-name group) t | |
1877 gnus-moderated-hashtb))) | |
1878 (set group nil))) | |
1879 (error | |
1880 (and group | |
1881 (symbolp group) | |
1882 (set group nil)) | |
1883 (unless ignore-errors | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1884 (gnus-message 3 "Warning - invalid active: %s" |
17493 | 1885 (buffer-substring |
1886 (gnus-point-at-bol) (gnus-point-at-eol)))))) | |
1887 (widen) | |
1888 (forward-line 1))))) | |
1889 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1890 (defun gnus-groups-to-gnus-format (method &optional hashtb real-active) |
17493 | 1891 ;; Parse a "groups" active file. |
1892 (let ((cur (current-buffer)) | |
1893 (hashtb (or hashtb | |
1894 (if (and method gnus-active-hashtb) | |
1895 gnus-active-hashtb | |
1896 (setq gnus-active-hashtb | |
1897 (gnus-make-hashtable | |
1898 (count-lines (point-min) (point-max))))))) | |
1899 (prefix (and method | |
1900 (not (gnus-server-equal | |
1901 (gnus-server-get-method nil method) | |
1902 (gnus-server-get-method nil gnus-select-method))) | |
1903 (gnus-group-prefixed-name "" method)))) | |
1904 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
1905 ;; Let the Gnus agent save the active file. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1906 (if (and gnus-agent |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1907 real-active |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1908 gnus-plugged |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1909 (gnus-agent-method-p method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1910 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1911 (gnus-agent-save-groups method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1912 (gnus-active-to-gnus-format method hashtb nil real-active)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1913 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1914 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1915 ;; We split this into to separate loops, one with the prefix |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1916 ;; and one without to speed the reading up somewhat. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1917 (if prefix |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1918 (let (min max opoint group) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1919 (while (not (eobp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1920 (condition-case () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1921 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1922 (read cur) (read cur) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1923 (setq min (read cur) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1924 max (read cur) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1925 opoint (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1926 (skip-chars-forward " \t") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1927 (insert prefix) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1928 (goto-char opoint) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1929 (set (let ((obarray hashtb)) (read cur)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1930 (cons min max))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1931 (error (and group (symbolp group) (set group nil)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1932 (forward-line 1))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1933 (let (min max group) |
17493 | 1934 (while (not (eobp)) |
1935 (condition-case () | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1936 (when (eq (char-after) ?2) |
17493 | 1937 (read cur) (read cur) |
1938 (setq min (read cur) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1939 max (read cur)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1940 (set (setq group (let ((obarray hashtb)) (read cur))) |
17493 | 1941 (cons min max))) |
1942 (error (and group (symbolp group) (set group nil)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1943 (forward-line 1))))))) |
17493 | 1944 |
1945 (defun gnus-read-newsrc-file (&optional force) | |
1946 "Read startup file. | |
1947 If FORCE is non-nil, the .newsrc file is read." | |
1948 ;; Reset variables that might be defined in the .newsrc.eld file. | |
1949 (let ((variables gnus-variable-list)) | |
1950 (while variables | |
1951 (set (car variables) nil) | |
1952 (setq variables (cdr variables)))) | |
1953 (let* ((newsrc-file gnus-current-startup-file) | |
1954 (quick-file (concat newsrc-file ".el"))) | |
1955 (save-excursion | |
1956 ;; We always load the .newsrc.eld file. If always contains | |
1957 ;; much information that can not be gotten from the .newsrc | |
1958 ;; file (ticked articles, killed groups, foreign methods, etc.) | |
1959 (gnus-read-newsrc-el-file quick-file) | |
1960 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1961 (when (and gnus-read-newsrc-file |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1962 (file-exists-p gnus-current-startup-file) |
17493 | 1963 (or force |
1964 (and (file-newer-than-file-p newsrc-file quick-file) | |
1965 (file-newer-than-file-p newsrc-file | |
1966 (concat quick-file "d"))) | |
1967 (not gnus-newsrc-alist))) | |
1968 ;; We read the .newsrc file. Note that if there if a | |
1969 ;; .newsrc.eld file exists, it has already been read, and | |
1970 ;; the `gnus-newsrc-hashtb' has been created. While reading | |
1971 ;; the .newsrc file, Gnus will only use the information it | |
1972 ;; can find there for changing the data already read - | |
1973 ;; i. e., reading the .newsrc file will not trash the data | |
1974 ;; already read (except for read articles). | |
1975 (save-excursion | |
1976 (gnus-message 5 "Reading %s..." newsrc-file) | |
1977 (set-buffer (nnheader-find-file-noselect newsrc-file)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
1978 (buffer-disable-undo) |
17493 | 1979 (gnus-newsrc-to-gnus-format) |
1980 (kill-buffer (current-buffer)) | |
1981 (gnus-message 5 "Reading %s...done" newsrc-file))) | |
1982 | |
1983 ;; Convert old to new. | |
1984 (gnus-convert-old-newsrc)))) | |
1985 | |
1986 (defun gnus-convert-old-newsrc () | |
1987 "Convert old newsrc into the new format, if needed." | |
1988 (let ((fcv (and gnus-newsrc-file-version | |
1989 (gnus-continuum-version gnus-newsrc-file-version)))) | |
1990 (cond | |
1991 ;; No .newsrc.eld file was loaded. | |
1992 ((null fcv) nil) | |
1993 ;; Gnus 5 .newsrc.eld was loaded. | |
1994 ((< fcv (gnus-continuum-version "September Gnus v0.1")) | |
1995 (gnus-convert-old-ticks))))) | |
1996 | |
1997 (defun gnus-convert-old-ticks () | |
1998 (let ((newsrc (cdr gnus-newsrc-alist)) | |
1999 marks info dormant ticked) | |
2000 (while (setq info (pop newsrc)) | |
2001 (when (setq marks (gnus-info-marks info)) | |
2002 (setq dormant (cdr (assq 'dormant marks)) | |
2003 ticked (cdr (assq 'tick marks))) | |
2004 (when (or dormant ticked) | |
2005 (gnus-info-set-read | |
2006 info | |
2007 (gnus-add-to-range | |
2008 (gnus-info-read info) | |
2009 (nconc (gnus-uncompress-range dormant) | |
2010 (gnus-uncompress-range ticked))))))))) | |
2011 | |
2012 (defun gnus-read-newsrc-el-file (file) | |
2013 (let ((ding-file (concat file "d"))) | |
2014 ;; We always, always read the .eld file. | |
2015 (gnus-message 5 "Reading %s..." ding-file) | |
2016 (let (gnus-newsrc-assoc) | |
2017 (condition-case nil | |
38627
6520def531cc
(gnus-startup-file-coding-system): Revert to binary.
Gerd Moellmann <gerd@gnu.org>
parents:
38612
diff
changeset
|
2018 (let ((coding-system-for-read gnus-ding-file-coding-system)) |
22942
39f23890e482
(gnus-startup-file-coding-system): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20235
diff
changeset
|
2019 (load ding-file t t t)) |
17493 | 2020 (error |
2021 (ding) | |
2022 (unless (gnus-yes-or-no-p | |
2023 (format "Error in %s; continue? " ding-file)) | |
2024 (error "Error in %s" ding-file)))) | |
2025 (when gnus-newsrc-assoc | |
2026 (setq gnus-newsrc-alist gnus-newsrc-assoc))) | |
2027 (gnus-make-hashtable-from-newsrc-alist) | |
2028 (when (file-newer-than-file-p file ding-file) | |
2029 ;; Old format quick file | |
2030 (gnus-message 5 "Reading %s..." file) | |
2031 ;; The .el file is newer than the .eld file, so we read that one | |
2032 ;; as well. | |
2033 (gnus-read-old-newsrc-el-file file)))) | |
2034 | |
2035 ;; Parse the old-style quick startup file | |
2036 (defun gnus-read-old-newsrc-el-file (file) | |
2037 (let (newsrc killed marked group m info) | |
2038 (prog1 | |
2039 (let ((gnus-killed-assoc nil) | |
2040 gnus-marked-assoc gnus-newsrc-alist gnus-newsrc-assoc) | |
2041 (prog1 | |
2042 (ignore-errors | |
2043 (load file t t t)) | |
2044 (setq newsrc gnus-newsrc-assoc | |
2045 killed gnus-killed-assoc | |
2046 marked gnus-marked-assoc))) | |
2047 (setq gnus-newsrc-alist nil) | |
2048 (while (setq group (pop newsrc)) | |
2049 (if (setq info (gnus-get-info (car group))) | |
2050 (progn | |
2051 (gnus-info-set-read info (cddr group)) | |
2052 (gnus-info-set-level | |
2053 info (if (nth 1 group) gnus-level-default-subscribed | |
2054 gnus-level-default-unsubscribed)) | |
2055 (push info gnus-newsrc-alist)) | |
2056 (push (setq info | |
2057 (list (car group) | |
2058 (if (nth 1 group) gnus-level-default-subscribed | |
2059 gnus-level-default-unsubscribed) | |
2060 (cddr group))) | |
2061 gnus-newsrc-alist)) | |
2062 ;; Copy marks into info. | |
2063 (when (setq m (assoc (car group) marked)) | |
2064 (unless (nthcdr 3 info) | |
2065 (nconc info (list nil))) | |
2066 (gnus-info-set-marks | |
2067 info (list (cons 'tick (gnus-compress-sequence | |
2068 (sort (cdr m) '<) t)))))) | |
2069 (setq newsrc killed) | |
2070 (while newsrc | |
2071 (setcar newsrc (caar newsrc)) | |
2072 (setq newsrc (cdr newsrc))) | |
2073 (setq gnus-killed-list killed)) | |
2074 ;; The .el file version of this variable does not begin with | |
2075 ;; "options", while the .eld version does, so we just add it if it | |
2076 ;; isn't there. | |
2077 (when | |
2078 gnus-newsrc-options | |
2079 (when (not (string-match "^ *options" gnus-newsrc-options)) | |
2080 (setq gnus-newsrc-options (concat "options " gnus-newsrc-options))) | |
2081 (when (not (string-match "\n$" gnus-newsrc-options)) | |
2082 (setq gnus-newsrc-options (concat gnus-newsrc-options "\n"))) | |
2083 ;; Finally, if we read some options lines, we parse them. | |
2084 (unless (string= gnus-newsrc-options "") | |
2085 (gnus-newsrc-parse-options gnus-newsrc-options))) | |
2086 | |
2087 (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist)) | |
2088 (gnus-make-hashtable-from-newsrc-alist))) | |
2089 | |
2090 (defun gnus-make-newsrc-file (file) | |
2091 "Make server dependent file name by catenating FILE and server host name." | |
2092 (let* ((file (expand-file-name file nil)) | |
2093 (real-file (concat file "-" (nth 1 gnus-select-method)))) | |
2094 (if (or (file-exists-p real-file) | |
2095 (file-exists-p (concat real-file ".el")) | |
2096 (file-exists-p (concat real-file ".eld"))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2097 real-file |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2098 file))) |
17493 | 2099 |
2100 (defun gnus-newsrc-to-gnus-format () | |
2101 (setq gnus-newsrc-options "") | |
2102 (setq gnus-newsrc-options-n nil) | |
2103 | |
2104 (unless gnus-active-hashtb | |
2105 (setq gnus-active-hashtb (gnus-make-hashtable 4096))) | |
2106 (let ((buf (current-buffer)) | |
2107 (already-read (> (length gnus-newsrc-alist) 1)) | |
2108 group subscribed options-symbol newsrc Options-symbol | |
2109 symbol reads num1) | |
2110 (goto-char (point-min)) | |
2111 ;; We intern the symbol `options' in the active hashtb so that we | |
2112 ;; can `eq' against it later. | |
2113 (set (setq options-symbol (intern "options" gnus-active-hashtb)) nil) | |
2114 (set (setq Options-symbol (intern "Options" gnus-active-hashtb)) nil) | |
2115 | |
2116 (while (not (eobp)) | |
2117 ;; We first read the first word on the line by narrowing and | |
2118 ;; then reading into `gnus-active-hashtb'. Most groups will | |
2119 ;; already exist in that hashtb, so this will save some string | |
2120 ;; space. | |
2121 (narrow-to-region | |
2122 (point) | |
2123 (progn (skip-chars-forward "^ \t!:\n") (point))) | |
2124 (goto-char (point-min)) | |
2125 (setq symbol | |
2126 (and (/= (point-min) (point-max)) | |
2127 (let ((obarray gnus-active-hashtb)) (read buf)))) | |
2128 (widen) | |
2129 ;; Now, the symbol we have read is either `options' or a group | |
2130 ;; name. If it is an options line, we just add it to a string. | |
2131 (cond | |
2132 ((or (eq symbol options-symbol) | |
2133 (eq symbol Options-symbol)) | |
2134 (setq gnus-newsrc-options | |
2135 ;; This concating is quite inefficient, but since our | |
2136 ;; thorough studies show that approx 99.37% of all | |
2137 ;; .newsrc files only contain a single options line, we | |
2138 ;; don't give a damn, frankly, my dear. | |
2139 (concat gnus-newsrc-options | |
2140 (buffer-substring | |
2141 (gnus-point-at-bol) | |
2142 ;; Options may continue on the next line. | |
2143 (or (and (re-search-forward "^[^ \t]" nil 'move) | |
2144 (progn (beginning-of-line) (point))) | |
2145 (point))))) | |
2146 (forward-line -1)) | |
2147 (symbol | |
2148 ;; Group names can be just numbers. | |
2149 (when (numberp symbol) | |
2150 (setq symbol (intern (int-to-string symbol) gnus-active-hashtb))) | |
2151 (unless (boundp symbol) | |
2152 (set symbol nil)) | |
2153 ;; It was a group name. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2154 (setq subscribed (eq (char-after) ?:) |
17493 | 2155 group (symbol-name symbol) |
2156 reads nil) | |
2157 (if (eolp) | |
2158 ;; If the line ends here, this is clearly a buggy line, so | |
46159 | 2159 ;; we put point at the beginning of line and let the cond |
17493 | 2160 ;; below do the error handling. |
2161 (beginning-of-line) | |
2162 ;; We skip to the beginning of the ranges. | |
2163 (skip-chars-forward "!: \t")) | |
2164 ;; We are now at the beginning of the list of read articles. | |
2165 ;; We read them range by range. | |
2166 (while | |
2167 (cond | |
2168 ((looking-at "[0-9]+") | |
2169 ;; We narrow and read a number instead of buffer-substring/ | |
2170 ;; string-to-int because it's faster. narrow/widen is | |
2171 ;; faster than save-restriction/narrow, and save-restriction | |
2172 ;; produces a garbage object. | |
2173 (setq num1 (progn | |
2174 (narrow-to-region (match-beginning 0) (match-end 0)) | |
2175 (read buf))) | |
2176 (widen) | |
2177 ;; If the next character is a dash, then this is a range. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2178 (if (eq (char-after) ?-) |
17493 | 2179 (progn |
2180 ;; We read the upper bound of the range. | |
2181 (forward-char 1) | |
2182 (if (not (looking-at "[0-9]+")) | |
2183 ;; This is a buggy line, by we pretend that | |
2184 ;; it's kinda OK. Perhaps the user should be | |
2185 ;; dinged? | |
2186 (push num1 reads) | |
2187 (push | |
2188 (cons num1 | |
2189 (progn | |
2190 (narrow-to-region (match-beginning 0) | |
2191 (match-end 0)) | |
2192 (read buf))) | |
2193 reads) | |
2194 (widen))) | |
2195 ;; It was just a simple number, so we add it to the | |
2196 ;; list of ranges. | |
2197 (push num1 reads)) | |
2198 ;; If the next char in ?\n, then we have reached the end | |
2199 ;; of the line and return nil. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2200 (not (eq (char-after) ?\n))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2201 ((eq (char-after) ?\n) |
17493 | 2202 ;; End of line, so we end. |
2203 nil) | |
2204 (t | |
2205 ;; Not numbers and not eol, so this might be a buggy | |
2206 ;; line... | |
2207 (unless (eobp) | |
2208 ;; If it was eob instead of ?\n, we allow it. | |
2209 ;; The line was buggy. | |
2210 (setq group nil) | |
2211 (gnus-error 3.1 "Mangled line: %s" | |
2212 (buffer-substring (gnus-point-at-bol) | |
2213 (gnus-point-at-eol)))) | |
2214 nil)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2215 ;; Skip past ", ". Spaces are invalid in these ranges, but |
17493 | 2216 ;; we allow them, because it's a common mistake to put a |
2217 ;; space after the comma. | |
2218 (skip-chars-forward ", ")) | |
2219 | |
2220 ;; We have already read .newsrc.eld, so we gently update the | |
2221 ;; data in the hash table with the information we have just | |
2222 ;; read. | |
2223 (when group | |
2224 (let ((info (gnus-get-info group)) | |
2225 level) | |
2226 (if info | |
2227 ;; There is an entry for this file in the alist. | |
2228 (progn | |
2229 (gnus-info-set-read info (nreverse reads)) | |
2230 ;; We update the level very gently. In fact, we | |
2231 ;; only change it if there's been a status change | |
2232 ;; from subscribed to unsubscribed, or vice versa. | |
2233 (setq level (gnus-info-level info)) | |
2234 (cond ((and (<= level gnus-level-subscribed) | |
2235 (not subscribed)) | |
2236 (setq level (if reads | |
2237 gnus-level-default-unsubscribed | |
2238 (1+ gnus-level-default-unsubscribed)))) | |
2239 ((and (> level gnus-level-subscribed) subscribed) | |
2240 (setq level gnus-level-default-subscribed))) | |
2241 (gnus-info-set-level info level)) | |
2242 ;; This is a new group. | |
2243 (setq info (list group | |
2244 (if subscribed | |
2245 gnus-level-default-subscribed | |
2246 (if reads | |
2247 (1+ gnus-level-subscribed) | |
2248 gnus-level-default-unsubscribed)) | |
2249 (nreverse reads)))) | |
2250 (push info newsrc))))) | |
2251 (forward-line 1)) | |
2252 | |
2253 (setq newsrc (nreverse newsrc)) | |
2254 | |
2255 (if (not already-read) | |
2256 () | |
2257 ;; We now have two newsrc lists - `newsrc', which is what we | |
2258 ;; have read from .newsrc, and `gnus-newsrc-alist', which is | |
2259 ;; what we've read from .newsrc.eld. We have to merge these | |
2260 ;; lists. We do this by "attaching" any (foreign) groups in the | |
2261 ;; gnus-newsrc-alist to the (native) group that precedes them. | |
2262 (let ((rc (cdr gnus-newsrc-alist)) | |
2263 (prev gnus-newsrc-alist) | |
2264 entry mentry) | |
2265 (while rc | |
2266 (or (null (nth 4 (car rc))) ; It's a native group. | |
2267 (assoc (caar rc) newsrc) ; It's already in the alist. | |
2268 (if (setq entry (assoc (caar prev) newsrc)) | |
2269 (setcdr (setq mentry (memq entry newsrc)) | |
2270 (cons (car rc) (cdr mentry))) | |
2271 (push (car rc) newsrc))) | |
2272 (setq prev rc | |
2273 rc (cdr rc))))) | |
2274 | |
2275 (setq gnus-newsrc-alist newsrc) | |
2276 ;; We make the newsrc hashtb. | |
2277 (gnus-make-hashtable-from-newsrc-alist) | |
2278 | |
2279 ;; Finally, if we read some options lines, we parse them. | |
2280 (unless (string= gnus-newsrc-options "") | |
2281 (gnus-newsrc-parse-options gnus-newsrc-options)))) | |
2282 | |
2283 ;; Parse options lines to find "options -n !all rec.all" and stuff. | |
2284 ;; The return value will be a list on the form | |
2285 ;; ((regexp1 . ignore) | |
2286 ;; (regexp2 . subscribe)...) | |
2287 ;; When handling new newsgroups, groups that match a `ignore' regexp | |
2288 ;; will be ignored, and groups that match a `subscribe' regexp will be | |
2289 ;; subscribed. A line like | |
2290 ;; options -n !all rec.all | |
2291 ;; will lead to a list that looks like | |
2292 ;; (("^rec\\..+" . subscribe) | |
2293 ;; ("^.+" . ignore)) | |
2294 ;; So all "rec.*" groups will be subscribed, while all the other | |
2295 ;; groups will be ignored. Note that "options -n !all rec.all" is very | |
2296 ;; different from "options -n rec.all !all". | |
2297 (defun gnus-newsrc-parse-options (options) | |
2298 (let (out eol) | |
2299 (save-excursion | |
2300 (gnus-set-work-buffer) | |
2301 (insert (regexp-quote options)) | |
2302 ;; First we treat all continuation lines. | |
2303 (goto-char (point-min)) | |
2304 (while (re-search-forward "\n[ \t]+" nil t) | |
2305 (replace-match " " t t)) | |
2306 ;; Then we transform all "all"s into ".+"s. | |
2307 (goto-char (point-min)) | |
2308 (while (re-search-forward "\\ball\\b" nil t) | |
2309 (replace-match ".+" t t)) | |
2310 (goto-char (point-min)) | |
2311 ;; We remove all other options than the "-n" ones. | |
2312 (while (re-search-forward "[ \t]-[^n][^-]*" nil t) | |
2313 (replace-match " ") | |
2314 (forward-char -1)) | |
2315 (goto-char (point-min)) | |
2316 | |
2317 ;; We are only interested in "options -n" lines - we | |
2318 ;; ignore the other option lines. | |
2319 (while (re-search-forward "[ \t]-n" nil t) | |
2320 (setq eol | |
2321 (or (save-excursion | |
2322 (and (re-search-forward "[ \t]-n" (gnus-point-at-eol) t) | |
2323 (- (point) 2))) | |
2324 (gnus-point-at-eol))) | |
2325 ;; Search for all "words"... | |
2326 (while (re-search-forward "[^ \t,\n]+" eol t) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2327 (if (eq (char-after (match-beginning 0)) ?!) |
17493 | 2328 ;; If the word begins with a bang (!), this is a "not" |
2329 ;; spec. We put this spec (minus the bang) and the | |
2330 ;; symbol `ignore' into the list. | |
2331 (push (cons (concat | |
2332 "^" (buffer-substring | |
2333 (1+ (match-beginning 0)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2334 (match-end 0)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2335 "\\($\\|\\.\\)") |
17493 | 2336 'ignore) |
2337 out) | |
2338 ;; There was no bang, so this is a "yes" spec. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2339 (push (cons (concat "^" (match-string 0) "\\($\\|\\.\\)") |
17493 | 2340 'subscribe) |
2341 out)))) | |
2342 | |
2343 (setq gnus-newsrc-options-n out)))) | |
2344 | |
2345 (defun gnus-save-newsrc-file (&optional force) | |
2346 "Save .newsrc file." | |
2347 ;; Note: We cannot save .newsrc file if all newsgroups are removed | |
2348 ;; from the variable gnus-newsrc-alist. | |
2349 (when (and (or gnus-newsrc-alist gnus-killed-list) | |
2350 gnus-current-startup-file) | |
2351 (save-excursion | |
2352 (if (and (or gnus-use-dribble-file gnus-slave) | |
2353 (not force) | |
2354 (or (not gnus-dribble-buffer) | |
2355 (not (buffer-name gnus-dribble-buffer)) | |
2356 (zerop (save-excursion | |
2357 (set-buffer gnus-dribble-buffer) | |
2358 (buffer-size))))) | |
2359 (gnus-message 4 "(No changes need to be saved)") | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2360 (gnus-run-hooks 'gnus-save-newsrc-hook) |
17493 | 2361 (if gnus-slave |
2362 (gnus-slave-save-newsrc) | |
2363 ;; Save .newsrc. | |
2364 (when gnus-save-newsrc-file | |
2365 (gnus-message 8 "Saving %s..." gnus-current-startup-file) | |
2366 (gnus-gnus-to-newsrc-format) | |
2367 (gnus-message 8 "Saving %s...done" gnus-current-startup-file)) | |
2368 ;; Save .newsrc.eld. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2369 (set-buffer (gnus-get-buffer-create " *Gnus-newsrc*")) |
17493 | 2370 (make-local-variable 'version-control) |
2371 (setq version-control 'never) | |
2372 (setq buffer-file-name | |
2373 (concat gnus-current-startup-file ".eld")) | |
2374 (setq default-directory (file-name-directory buffer-file-name)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2375 (buffer-disable-undo) |
17493 | 2376 (erase-buffer) |
2377 (gnus-message 5 "Saving %s.eld..." gnus-current-startup-file) | |
2378 (gnus-gnus-to-quick-newsrc-format) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2379 (gnus-run-hooks 'gnus-save-quick-newsrc-hook) |
38627
6520def531cc
(gnus-startup-file-coding-system): Revert to binary.
Gerd Moellmann <gerd@gnu.org>
parents:
38612
diff
changeset
|
2380 (let ((coding-system-for-write gnus-ding-file-coding-system)) |
23103 | 2381 (save-buffer)) |
17493 | 2382 (kill-buffer (current-buffer)) |
2383 (gnus-message | |
2384 5 "Saving %s.eld...done" gnus-current-startup-file)) | |
2385 (gnus-dribble-delete-file) | |
2386 (gnus-group-set-mode-line))))) | |
2387 | |
2388 (defun gnus-gnus-to-quick-newsrc-format () | |
2389 "Insert Gnus variables such as gnus-newsrc-alist in lisp format." | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
2390 (let ((print-quoted t) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19910
diff
changeset
|
2391 (print-escape-newlines t)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2392 |
17493 | 2393 (insert ";; -*- emacs-lisp -*-\n") |
2394 (insert ";; Gnus startup file.\n") | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2395 (insert "\ |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2396 ;; Never delete this file -- if you want to force Gnus to read the |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2397 ;; .newsrc file (if you have one), touch .newsrc instead.\n") |
17493 | 2398 (insert "(setq gnus-newsrc-file-version " |
2399 (prin1-to-string gnus-version) ")\n") | |
2400 (let* ((gnus-killed-list | |
2401 (if (and gnus-save-killed-list | |
2402 (stringp gnus-save-killed-list)) | |
2403 (gnus-strip-killed-list) | |
2404 gnus-killed-list)) | |
2405 (variables | |
2406 (if gnus-save-killed-list gnus-variable-list | |
2407 ;; Remove the `gnus-killed-list' from the list of variables | |
2408 ;; to be saved, if required. | |
2409 (delq 'gnus-killed-list (copy-sequence gnus-variable-list)))) | |
2410 ;; Peel off the "dummy" group. | |
2411 (gnus-newsrc-alist (cdr gnus-newsrc-alist)) | |
2412 variable) | |
2413 ;; Insert the variables into the file. | |
2414 (while variables | |
2415 (when (and (boundp (setq variable (pop variables))) | |
2416 (symbol-value variable)) | |
2417 (insert "(setq " (symbol-name variable) " '") | |
2418 (gnus-prin1 (symbol-value variable)) | |
2419 (insert ")\n")))))) | |
2420 | |
2421 (defun gnus-strip-killed-list () | |
2422 "Return the killed list minus the groups that match `gnus-save-killed-list'." | |
2423 (let ((list gnus-killed-list) | |
2424 olist) | |
2425 (while list | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2426 (when (string-match gnus-save-killed-list (car list)) |
17493 | 2427 (push (car list) olist)) |
2428 (pop list)) | |
2429 (nreverse olist))) | |
2430 | |
2431 (defun gnus-gnus-to-newsrc-format () | |
2432 ;; Generate and save the .newsrc file. | |
2433 (save-excursion | |
2434 (set-buffer (create-file-buffer gnus-current-startup-file)) | |
2435 (let ((newsrc (cdr gnus-newsrc-alist)) | |
2436 (standard-output (current-buffer)) | |
2437 info ranges range method) | |
2438 (setq buffer-file-name gnus-current-startup-file) | |
2439 (setq default-directory (file-name-directory buffer-file-name)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2440 (buffer-disable-undo) |
17493 | 2441 (erase-buffer) |
2442 ;; Write options. | |
2443 (when gnus-newsrc-options | |
2444 (insert gnus-newsrc-options)) | |
2445 ;; Write subscribed and unsubscribed. | |
2446 (while (setq info (pop newsrc)) | |
2447 ;; Don't write foreign groups to .newsrc. | |
2448 (when (or (null (setq method (gnus-info-method info))) | |
2449 (equal method "native") | |
2450 (inline (gnus-server-equal method gnus-select-method))) | |
2451 (insert (gnus-info-group info) | |
2452 (if (> (gnus-info-level info) gnus-level-subscribed) | |
2453 "!" ":")) | |
2454 (when (setq ranges (gnus-info-read info)) | |
2455 (insert " ") | |
2456 (if (not (listp (cdr ranges))) | |
2457 (if (= (car ranges) (cdr ranges)) | |
2458 (princ (car ranges)) | |
2459 (princ (car ranges)) | |
2460 (insert "-") | |
2461 (princ (cdr ranges))) | |
2462 (while (setq range (pop ranges)) | |
2463 (if (or (atom range) (= (car range) (cdr range))) | |
2464 (princ (or (and (atom range) range) (car range))) | |
2465 (princ (car range)) | |
2466 (insert "-") | |
2467 (princ (cdr range))) | |
2468 (when ranges | |
2469 (insert ","))))) | |
2470 (insert "\n"))) | |
2471 (make-local-variable 'version-control) | |
2472 (setq version-control 'never) | |
2473 ;; It has been reported that sometime the modtime on the .newsrc | |
2474 ;; file seems to be off. We really do want to overwrite it, so | |
2475 ;; we clear the modtime here before saving. It's a bit odd, | |
2476 ;; though... | |
2477 ;; sometimes the modtime clear isn't sufficient. most brute force: | |
2478 ;; delete the silly thing entirely first. but this fails to provide | |
2479 ;; such niceties as .newsrc~ creation. | |
2480 (if gnus-modtime-botch | |
2481 (delete-file gnus-startup-file) | |
2482 (clear-visited-file-modtime)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2483 (gnus-run-hooks 'gnus-save-standard-newsrc-hook) |
17493 | 2484 (save-buffer) |
2485 (kill-buffer (current-buffer))))) | |
2486 | |
2487 | |
2488 ;;; | |
2489 ;;; Slave functions. | |
2490 ;;; | |
2491 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2492 (defvar gnus-slave-mode nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2493 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2494 (defun gnus-slave-mode () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2495 "Minor mode for slave Gnusae." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2496 (gnus-add-minor-mode 'gnus-slave-mode " Slave" (make-sparse-keymap)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2497 (gnus-run-hooks 'gnus-slave-mode-hook)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2498 |
17493 | 2499 (defun gnus-slave-save-newsrc () |
2500 (save-excursion | |
2501 (set-buffer gnus-dribble-buffer) | |
2502 (let ((slave-name | |
44075
7782e54757bb
* mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
42628
diff
changeset
|
2503 (mm-make-temp-file (concat gnus-current-startup-file "-slave-"))) |
17493 | 2504 (modes (ignore-errors |
2505 (file-modes (concat gnus-current-startup-file ".eld"))))) | |
38627
6520def531cc
(gnus-startup-file-coding-system): Revert to binary.
Gerd Moellmann <gerd@gnu.org>
parents:
38612
diff
changeset
|
2506 (let ((coding-system-for-write gnus-ding-file-coding-system)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2507 (gnus-write-buffer slave-name)) |
17493 | 2508 (when modes |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2509 (set-file-modes slave-name modes))))) |
17493 | 2510 |
2511 (defun gnus-master-read-slave-newsrc () | |
2512 (let ((slave-files | |
2513 (directory-files | |
2514 (file-name-directory gnus-current-startup-file) | |
2515 t (concat | |
2516 "^" (regexp-quote | |
2517 (concat | |
2518 (file-name-nondirectory gnus-current-startup-file) | |
2519 "-slave-"))) | |
2520 t)) | |
2521 file) | |
2522 (if (not slave-files) | |
2523 () ; There are no slave files to read. | |
2524 (gnus-message 7 "Reading slave newsrcs...") | |
2525 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2526 (set-buffer (gnus-get-buffer-create " *gnus slave*")) |
17493 | 2527 (setq slave-files |
2528 (sort (mapcar (lambda (file) | |
2529 (list (nth 5 (file-attributes file)) file)) | |
2530 slave-files) | |
2531 (lambda (f1 f2) | |
2532 (or (< (caar f1) (caar f2)) | |
2533 (< (nth 1 (car f1)) (nth 1 (car f2))))))) | |
2534 (while slave-files | |
2535 (erase-buffer) | |
2536 (setq file (nth 1 (car slave-files))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2537 (nnheader-insert-file-contents file) |
17493 | 2538 (when (condition-case () |
2539 (progn | |
2540 (eval-buffer (current-buffer)) | |
2541 t) | |
2542 (error | |
2543 (gnus-error 3.2 "Possible error in %s" file) | |
2544 nil)) | |
2545 (unless gnus-slave ; Slaves shouldn't delete these files. | |
2546 (ignore-errors | |
2547 (delete-file file)))) | |
2548 (setq slave-files (cdr slave-files)))) | |
2549 (gnus-dribble-touch) | |
2550 (gnus-message 7 "Reading slave newsrcs...done")))) | |
2551 | |
2552 | |
2553 ;;; | |
2554 ;;; Group description. | |
2555 ;;; | |
2556 | |
2557 (defun gnus-read-all-descriptions-files () | |
2558 (let ((methods (cons gnus-select-method | |
2559 (nconc | |
2560 (when (gnus-archive-server-wanted-p) | |
2561 (list "archive")) | |
2562 gnus-secondary-select-methods)))) | |
2563 (while methods | |
2564 (gnus-read-descriptions-file (car methods)) | |
2565 (setq methods (cdr methods))) | |
2566 t)) | |
2567 | |
2568 (defun gnus-read-descriptions-file (&optional method) | |
2569 (let ((method (or method gnus-select-method)) | |
2570 group) | |
2571 (when (stringp method) | |
2572 (setq method (gnus-server-to-method method))) | |
2573 ;; We create the hashtable whether we manage to read the desc file | |
2574 ;; to avoid trying to re-read after a failed read. | |
2575 (unless gnus-description-hashtb | |
2576 (setq gnus-description-hashtb | |
2577 (gnus-make-hashtable (length gnus-active-hashtb)))) | |
2578 ;; Mark this method's desc file as read. | |
2579 (gnus-sethash (gnus-group-prefixed-name "" method) "Has read" | |
2580 gnus-description-hashtb) | |
2581 | |
2582 (gnus-message 5 "Reading descriptions file via %s..." (car method)) | |
2583 (cond | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2584 ((null (gnus-get-function method 'request-list-newsgroups t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2585 t) |
17493 | 2586 ((not (gnus-check-server method)) |
2587 (gnus-message 1 "Couldn't open server") | |
2588 nil) | |
2589 ((not (gnus-request-list-newsgroups method)) | |
2590 (gnus-message 1 "Couldn't read newsgroups descriptions") | |
2591 nil) | |
2592 (t | |
2593 (save-excursion | |
2594 (save-restriction | |
2595 (set-buffer nntp-server-buffer) | |
2596 (goto-char (point-min)) | |
2597 (when (or (search-forward "\n.\n" nil t) | |
2598 (goto-char (point-max))) | |
2599 (beginning-of-line) | |
2600 (narrow-to-region (point-min) (point))) | |
2601 ;; If these are groups from a foreign select method, we insert the | |
2602 ;; group prefix in front of the group names. | |
2603 (and method (not (inline | |
2604 (gnus-server-equal | |
2605 (gnus-server-get-method nil method) | |
2606 (gnus-server-get-method | |
2607 nil gnus-select-method)))) | |
2608 (let ((prefix (gnus-group-prefixed-name "" method))) | |
2609 (goto-char (point-min)) | |
2610 (while (and (not (eobp)) | |
2611 (progn (insert prefix) | |
2612 (zerop (forward-line 1))))))) | |
2613 (goto-char (point-min)) | |
2614 (while (not (eobp)) | |
2615 ;; If we get an error, we set group to 0, which is not a | |
2616 ;; symbol... | |
2617 (setq group | |
2618 (condition-case () | |
2619 (let ((obarray gnus-description-hashtb)) | |
2620 ;; Group is set to a symbol interned in this | |
2621 ;; hash table. | |
2622 (read nntp-server-buffer)) | |
2623 (error 0))) | |
2624 (skip-chars-forward " \t") | |
2625 ;; ... which leads to this line being effectively ignored. | |
2626 (when (symbolp group) | |
20235
518f3a9e5812
(gnus-read-descriptions-file): Decode
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
2627 (let ((str (buffer-substring |
518f3a9e5812
(gnus-read-descriptions-file): Decode
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
2628 (point) (progn (end-of-line) (point)))) |
518f3a9e5812
(gnus-read-descriptions-file): Decode
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
2629 (coding |
32939
c8119677d63e
Use (featurep 'xemacs) instead of the `gnus-xemacs' variable, as the
Miles Bader <miles@gnu.org>
parents:
31783
diff
changeset
|
2630 (and (or (featurep 'xemacs) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2631 (and (boundp 'enable-multibyte-characters) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2632 enable-multibyte-characters)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23103
diff
changeset
|
2633 (fboundp 'gnus-mule-get-coding-system) |
20235
518f3a9e5812
(gnus-read-descriptions-file): Decode
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
2634 (gnus-mule-get-coding-system (symbol-name group))))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2635 (when coding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2636 (setq str (mm-decode-coding-string str (car coding)))) |
20235
518f3a9e5812
(gnus-read-descriptions-file): Decode
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
2637 (set group str))) |
17493 | 2638 (forward-line 1)))) |
2639 (gnus-message 5 "Reading descriptions file...done") | |
2640 t)))) | |
2641 | |
2642 (defun gnus-group-get-description (group) | |
2643 "Get the description of a group by sending XGTITLE to the server." | |
2644 (when (gnus-request-group-description group) | |
2645 (save-excursion | |
2646 (set-buffer nntp-server-buffer) | |
2647 (goto-char (point-min)) | |
2648 (when (looking-at "[^ \t]+[ \t]+\\(.*\\)") | |
2649 (match-string 1))))) | |
2650 | |
2651 ;;;###autoload | |
2652 (defun gnus-declare-backend (name &rest abilities) | |
2653 "Declare backend NAME with ABILITIES as a Gnus backend." | |
2654 (setq gnus-valid-select-methods | |
2655 (nconc gnus-valid-select-methods | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2656 (list (apply 'list name abilities)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
26039
diff
changeset
|
2657 (gnus-redefine-select-method-widget)) |
17493 | 2658 |
2659 (defun gnus-set-default-directory () | |
2660 "Set the default directory in the current buffer to `gnus-default-directory'. | |
2661 If this variable is nil, don't do anything." | |
2662 (setq default-directory | |
2663 (if (and gnus-default-directory | |
2664 (file-exists-p gnus-default-directory)) | |
2665 (file-name-as-directory (expand-file-name gnus-default-directory)) | |
2666 default-directory))) | |
2667 | |
2668 (provide 'gnus-start) | |
2669 | |
2670 ;;; gnus-start.el ends here |