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