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