Switch to recommended form of GPLv3 permissions notice.
[bpt/emacs.git] / lisp / gnus / gnus.el
CommitLineData
5e67c784 1;;; gnus.el --- a newsreader for GNU Emacs
23f87bed 2
e84b4b86 3;; Copyright (C) 1987, 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997, 1998,
e3fe4da0 4;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
eec82323
LMI
5
6;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6748645f 7;; Lars Magne Ingebrigtsen <larsi@gnus.org>
eec82323
LMI
8;; Keywords: news, mail
9
10;; This file is part of GNU Emacs.
11
5e809f55 12;; GNU Emacs is free software: you can redistribute it and/or modify
eec82323 13;; it under the terms of the GNU General Public License as published by
5e809f55
GM
14;; the Free Software Foundation, either version 3 of the License, or
15;; (at your option) any later version.
eec82323
LMI
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
65a32076 19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eec82323
LMI
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
5e809f55 23;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
eec82323
LMI
24
25;;; Commentary:
26
27;;; Code:
28
29(eval '(run-hooks 'gnus-load-hook))
30
c7e9cfaf
GM
31;; For Emacs < 22.2.
32(eval-and-compile
33 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
34
a36c8d02 35(eval-when-compile (require 'cl))
23f87bed 36(require 'wid-edit)
16409b0b 37(require 'mm-util)
23f87bed 38(require 'nnheader)
a36c8d02 39
0005c181
JB
40;; These are defined afterwards with gnus-define-group-parameter
41(defvar gnus-ham-process-destinations)
42(defvar gnus-parameter-ham-marks-alist)
43(defvar gnus-parameter-spam-marks-alist)
44(defvar gnus-spam-autodetect)
45(defvar gnus-spam-autodetect-methods)
46(defvar gnus-spam-newsgroup-contents)
47(defvar gnus-spam-process-destinations)
a9b833d3
GM
48(defvar gnus-spam-resend-to)
49(defvar gnus-ham-resend-to)
0005c181
JB
50(defvar gnus-spam-process-newsgroups)
51
52
eec82323
LMI
53(defgroup gnus nil
54 "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
55 :group 'news
56 :group 'mail)
57
4573e0df
MB
58(defgroup gnus-start nil
59 "Starting your favorite newsreader."
60 :group 'gnus)
61
23f87bed
MB
62(defgroup gnus-format nil
63 "Dealing with formatting issues."
64 :group 'gnus)
65
16409b0b
GM
66(defgroup gnus-charset nil
67 "Group character set issues."
68 :link '(custom-manual "(gnus)Charsets")
69 :version "21.1"
70 :group 'gnus)
71
6748645f
LMI
72(defgroup gnus-cache nil
73 "Cache interface."
23f87bed
MB
74 :link '(custom-manual "(gnus)Article Caching")
75 :group 'gnus)
76
77(defgroup gnus-registry nil
78 "Article Registry."
6748645f
LMI
79 :group 'gnus)
80
eec82323
LMI
81(defgroup gnus-start-server nil
82 "Server options at startup."
83 :group 'gnus-start)
84
85;; These belong to gnus-group.el.
86(defgroup gnus-group nil
87 "Group buffers."
23f87bed 88 :link '(custom-manual "(gnus)Group Buffer")
eec82323
LMI
89 :group 'gnus)
90
91(defgroup gnus-group-foreign nil
92 "Foreign groups."
93 :link '(custom-manual "(gnus)Foreign Groups")
94 :group 'gnus-group)
95
96(defgroup gnus-group-new nil
97 "Automatic subscription of new groups."
98 :group 'gnus-group)
99
100(defgroup gnus-group-levels nil
101 "Group levels."
102 :link '(custom-manual "(gnus)Group Levels")
103 :group 'gnus-group)
104
105(defgroup gnus-group-select nil
106 "Selecting a Group."
107 :link '(custom-manual "(gnus)Selecting a Group")
108 :group 'gnus-group)
109
110(defgroup gnus-group-listing nil
111 "Showing slices of the group list."
112 :link '(custom-manual "(gnus)Listing Groups")
113 :group 'gnus-group)
114
115(defgroup gnus-group-visual nil
116 "Sorting the group buffer."
117 :link '(custom-manual "(gnus)Group Buffer Format")
118 :group 'gnus-group
119 :group 'gnus-visual)
120
121(defgroup gnus-group-various nil
122 "Various group options."
123 :link '(custom-manual "(gnus)Scanning New Messages")
124 :group 'gnus-group)
125
126;; These belong to gnus-sum.el.
127(defgroup gnus-summary nil
128 "Summary buffers."
23f87bed 129 :link '(custom-manual "(gnus)Summary Buffer")
eec82323
LMI
130 :group 'gnus)
131
132(defgroup gnus-summary-exit nil
133 "Leaving summary buffers."
134 :link '(custom-manual "(gnus)Exiting the Summary Buffer")
135 :group 'gnus-summary)
136
137(defgroup gnus-summary-marks nil
138 "Marks used in summary buffers."
139 :link '(custom-manual "(gnus)Marking Articles")
140 :group 'gnus-summary)
141
142(defgroup gnus-thread nil
143 "Ordering articles according to replies."
144 :link '(custom-manual "(gnus)Threading")
145 :group 'gnus-summary)
146
147(defgroup gnus-summary-format nil
148 "Formatting of the summary buffer."
149 :link '(custom-manual "(gnus)Summary Buffer Format")
150 :group 'gnus-summary)
151
152(defgroup gnus-summary-choose nil
153 "Choosing Articles."
154 :link '(custom-manual "(gnus)Choosing Articles")
155 :group 'gnus-summary)
156
157(defgroup gnus-summary-maneuvering nil
158 "Summary movement commands."
159 :link '(custom-manual "(gnus)Summary Maneuvering")
160 :group 'gnus-summary)
161
23f87bed
MB
162(defgroup gnus-picon nil
163 "Show pictures of people, domains, and newsgroups."
164 :group 'gnus-visual)
165
eec82323
LMI
166(defgroup gnus-summary-mail nil
167 "Mail group commands."
168 :link '(custom-manual "(gnus)Mail Group Commands")
169 :group 'gnus-summary)
170
171(defgroup gnus-summary-sort nil
172 "Sorting the summary buffer."
23f87bed 173 :link '(custom-manual "(gnus)Sorting the Summary Buffer")
eec82323
LMI
174 :group 'gnus-summary)
175
176(defgroup gnus-summary-visual nil
177 "Highlighting and menus in the summary buffer."
178 :link '(custom-manual "(gnus)Summary Highlighting")
179 :group 'gnus-visual
180 :group 'gnus-summary)
181
182(defgroup gnus-summary-various nil
183 "Various summary buffer options."
184 :link '(custom-manual "(gnus)Various Summary Stuff")
185 :group 'gnus-summary)
186
a8151ef7
LMI
187(defgroup gnus-summary-pick nil
188 "Pick mode in the summary buffer."
189 :link '(custom-manual "(gnus)Pick and Read")
190 :prefix "gnus-pick-"
191 :group 'gnus-summary)
192
193(defgroup gnus-summary-tree nil
194 "Tree display of threads in the summary buffer."
195 :link '(custom-manual "(gnus)Tree Display")
196 :prefix "gnus-tree-"
197 :group 'gnus-summary)
198
eec82323
LMI
199;; Belongs to gnus-uu.el
200(defgroup gnus-extract-view nil
201 "Viewing extracted files."
202 :link '(custom-manual "(gnus)Viewing Files")
203 :group 'gnus-extract)
204
205;; Belongs to gnus-score.el
206(defgroup gnus-score nil
207 "Score and kill file handling."
208 :group 'gnus)
209
210(defgroup gnus-score-kill nil
211 "Kill files."
212 :group 'gnus-score)
213
214(defgroup gnus-score-adapt nil
215 "Adaptive score files."
216 :group 'gnus-score)
217
218(defgroup gnus-score-default nil
219 "Default values for score files."
220 :group 'gnus-score)
221
222(defgroup gnus-score-expire nil
223 "Expiring score rules."
224 :group 'gnus-score)
225
226(defgroup gnus-score-decay nil
227 "Decaying score rules."
228 :group 'gnus-score)
229
230(defgroup gnus-score-files nil
231 "Score and kill file names."
232 :group 'gnus-score
233 :group 'gnus-files)
234
235(defgroup gnus-score-various nil
236 "Various scoring and killing options."
237 :group 'gnus-score)
238
239;; Other
240(defgroup gnus-visual nil
23f87bed 241 "Options controlling the visual fluff."
eec82323
LMI
242 :group 'gnus
243 :group 'faces)
244
6748645f
LMI
245(defgroup gnus-agent nil
246 "Offline support for Gnus."
247 :group 'gnus)
248
eec82323
LMI
249(defgroup gnus-files nil
250 "Files used by Gnus."
251 :group 'gnus)
252
253(defgroup gnus-dribble-file nil
254 "Auto save file."
255 :link '(custom-manual "(gnus)Auto Save")
256 :group 'gnus-files)
257
258(defgroup gnus-newsrc nil
259 "Storing Gnus state."
260 :group 'gnus-files)
261
262(defgroup gnus-server nil
263 "Options related to newsservers and other servers used by Gnus."
264 :group 'gnus)
265
23f87bed
MB
266(defgroup gnus-server-visual nil
267 "Highlighting and menus in the server buffer."
268 :group 'gnus-visual
269 :group 'gnus-server)
270
eec82323
LMI
271(defgroup gnus-message '((message custom-group))
272 "Composing replies and followups in Gnus."
273 :group 'gnus)
274
275(defgroup gnus-meta nil
23f87bed 276 "Meta variables controlling major portions of Gnus.
eec82323
LMI
277In general, modifying these variables does not take affect until Gnus
278is restarted, and sometimes reloaded."
279 :group 'gnus)
280
281(defgroup gnus-various nil
282 "Other Gnus options."
283 :link '(custom-manual "(gnus)Various Various")
284 :group 'gnus)
285
286(defgroup gnus-exit nil
873f3c50 287 "Exiting Gnus."
eec82323
LMI
288 :link '(custom-manual "(gnus)Exiting Gnus")
289 :group 'gnus)
290
23f87bed
MB
291(defgroup gnus-fun nil
292 "Frivolous Gnus extensions."
293 :link '(custom-manual "(gnus)Exiting Gnus")
294 :group 'gnus)
295
c7ff939a 296(defconst gnus-version-number "5.13"
eec82323
LMI
297 "Version number for this version of Gnus.")
298
c7ff939a 299(defconst gnus-version (format "Gnus v%s" gnus-version-number)
eec82323
LMI
300 "Version string for this version of Gnus.")
301
302(defcustom gnus-inhibit-startup-message nil
303 "If non-nil, the startup message will not be displayed.
304This variable is used before `.gnus.el' is loaded, so it should
305be set in `.emacs' instead."
306 :group 'gnus-start
307 :type 'boolean)
308
309(defcustom gnus-play-startup-jingle nil
310 "If non-nil, play the Gnus jingle at startup."
311 :group 'gnus-start
312 :type 'boolean)
313
23f87bed
MB
314(unless (fboundp 'gnus-group-remove-excess-properties)
315 (defalias 'gnus-group-remove-excess-properties 'ignore))
316
eec82323
LMI
317(unless (featurep 'gnus-xmas)
318 (defalias 'gnus-make-overlay 'make-overlay)
6748645f 319 (defalias 'gnus-delete-overlay 'delete-overlay)
eec82323
LMI
320 (defalias 'gnus-overlay-put 'overlay-put)
321 (defalias 'gnus-move-overlay 'move-overlay)
48df946a
DL
322 (defalias 'gnus-overlay-buffer 'overlay-buffer)
323 (defalias 'gnus-overlay-start 'overlay-start)
eec82323
LMI
324 (defalias 'gnus-overlay-end 'overlay-end)
325 (defalias 'gnus-extent-detached-p 'ignore)
326 (defalias 'gnus-extent-start-open 'ignore)
eec82323
LMI
327 (defalias 'gnus-mail-strip-quoted-names 'mail-strip-quoted-names)
328 (defalias 'gnus-character-to-event 'identity)
23f87bed 329 (defalias 'gnus-assq-delete-all 'assq-delete-all)
eec82323
LMI
330 (defalias 'gnus-add-text-properties 'add-text-properties)
331 (defalias 'gnus-put-text-property 'put-text-property)
16409b0b
GM
332 (defvar gnus-mode-line-image-cache t)
333 (if (fboundp 'find-image)
334 (defun gnus-mode-line-buffer-identification (line)
d31fa104
MB
335 (let ((str (car-safe line))
336 (load-path (mm-image-load-path)))
16409b0b
GM
337 (if (and (stringp str)
338 (string-match "^Gnus:" str))
339 (progn (add-text-properties
340 0 5
341 (list 'display
342 (if (eq t gnus-mode-line-image-cache)
343 (setq gnus-mode-line-image-cache
344 (find-image
345 '((:type xpm :file "gnus-pointer.xpm"
e03eed51 346 :ascent center)
16409b0b 347 (:type xbm :file "gnus-pointer.xbm"
e03eed51 348 :ascent center))))
16409b0b 349 gnus-mode-line-image-cache)
23f87bed
MB
350 'help-echo (format
351 "This is %s, %s."
352 gnus-version (gnus-emacs-version)))
16409b0b
GM
353 str)
354 (list str))
355 line)))
356 (defalias 'gnus-mode-line-buffer-identification 'identity))
eec82323 357 (defalias 'gnus-characterp 'numberp)
6748645f
LMI
358 (defalias 'gnus-deactivate-mark 'deactivate-mark)
359 (defalias 'gnus-window-edges 'window-edges)
16409b0b 360 (defalias 'gnus-key-press-event-p 'numberp)
23f87bed
MB
361 ;;(defalias 'gnus-decode-rfc1522 'ignore)
362 )
eec82323 363
eec82323
LMI
364;; We define these group faces here to avoid the display
365;; update forced when creating new faces.
366
0f49874b 367(defface gnus-group-news-1
eec82323
LMI
368 '((((class color)
369 (background dark))
23f87bed 370 (:foreground "PaleTurquoise" :bold t))
eec82323
LMI
371 (((class color)
372 (background light))
23f87bed 373 (:foreground "ForestGreen" :bold t))
eec82323
LMI
374 (t
375 ()))
d0859c9a
MB
376 "Level 1 newsgroup face."
377 :group 'gnus-group)
0f49874b
MB
378;; backward-compatibility alias
379(put 'gnus-group-news-1-face 'face-alias 'gnus-group-news-1)
eec82323 380
0f49874b 381(defface gnus-group-news-1-empty
eec82323
LMI
382 '((((class color)
383 (background dark))
384 (:foreground "PaleTurquoise"))
385 (((class color)
386 (background light))
387 (:foreground "ForestGreen"))
388 (t
389 ()))
d0859c9a
MB
390 "Level 1 empty newsgroup face."
391 :group 'gnus-group)
0f49874b
MB
392;; backward-compatibility alias
393(put 'gnus-group-news-1-empty-face 'face-alias 'gnus-group-news-1-empty)
eec82323 394
0f49874b 395(defface gnus-group-news-2
eec82323
LMI
396 '((((class color)
397 (background dark))
23f87bed 398 (:foreground "turquoise" :bold t))
eec82323
LMI
399 (((class color)
400 (background light))
23f87bed 401 (:foreground "CadetBlue4" :bold t))
eec82323
LMI
402 (t
403 ()))
d0859c9a
MB
404 "Level 2 newsgroup face."
405 :group 'gnus-group)
0f49874b
MB
406;; backward-compatibility alias
407(put 'gnus-group-news-2-face 'face-alias 'gnus-group-news-2)
eec82323 408
0f49874b 409(defface gnus-group-news-2-empty
eec82323
LMI
410 '((((class color)
411 (background dark))
412 (:foreground "turquoise"))
413 (((class color)
414 (background light))
415 (:foreground "CadetBlue4"))
416 (t
417 ()))
d0859c9a
MB
418 "Level 2 empty newsgroup face."
419 :group 'gnus-group)
0f49874b
MB
420;; backward-compatibility alias
421(put 'gnus-group-news-2-empty-face 'face-alias 'gnus-group-news-2-empty)
eec82323 422
0f49874b 423(defface gnus-group-news-3
eec82323
LMI
424 '((((class color)
425 (background dark))
23f87bed 426 (:bold t))
eec82323
LMI
427 (((class color)
428 (background light))
23f87bed 429 (:bold t))
eec82323
LMI
430 (t
431 ()))
d0859c9a
MB
432 "Level 3 newsgroup face."
433 :group 'gnus-group)
0f49874b
MB
434;; backward-compatibility alias
435(put 'gnus-group-news-3-face 'face-alias 'gnus-group-news-3)
eec82323 436
0f49874b 437(defface gnus-group-news-3-empty
eec82323
LMI
438 '((((class color)
439 (background dark))
440 ())
441 (((class color)
442 (background light))
443 ())
444 (t
445 ()))
d0859c9a
MB
446 "Level 3 empty newsgroup face."
447 :group 'gnus-group)
0f49874b
MB
448;; backward-compatibility alias
449(put 'gnus-group-news-3-empty-face 'face-alias 'gnus-group-news-3-empty)
eec82323 450
0f49874b 451(defface gnus-group-news-4
16409b0b
GM
452 '((((class color)
453 (background dark))
23f87bed 454 (:bold t))
16409b0b
GM
455 (((class color)
456 (background light))
23f87bed 457 (:bold t))
16409b0b
GM
458 (t
459 ()))
d0859c9a
MB
460 "Level 4 newsgroup face."
461 :group 'gnus-group)
0f49874b
MB
462;; backward-compatibility alias
463(put 'gnus-group-news-4-face 'face-alias 'gnus-group-news-4)
16409b0b 464
0f49874b 465(defface gnus-group-news-4-empty
16409b0b
GM
466 '((((class color)
467 (background dark))
468 ())
469 (((class color)
470 (background light))
471 ())
472 (t
473 ()))
d0859c9a
MB
474 "Level 4 empty newsgroup face."
475 :group 'gnus-group)
0f49874b
MB
476;; backward-compatibility alias
477(put 'gnus-group-news-4-empty-face 'face-alias 'gnus-group-news-4-empty)
16409b0b 478
0f49874b 479(defface gnus-group-news-5
16409b0b
GM
480 '((((class color)
481 (background dark))
23f87bed 482 (:bold t))
16409b0b
GM
483 (((class color)
484 (background light))
23f87bed 485 (:bold t))
16409b0b
GM
486 (t
487 ()))
d0859c9a
MB
488 "Level 5 newsgroup face."
489 :group 'gnus-group)
0f49874b
MB
490;; backward-compatibility alias
491(put 'gnus-group-news-5-face 'face-alias 'gnus-group-news-5)
16409b0b 492
0f49874b 493(defface gnus-group-news-5-empty
16409b0b
GM
494 '((((class color)
495 (background dark))
496 ())
497 (((class color)
498 (background light))
499 ())
500 (t
501 ()))
d0859c9a
MB
502 "Level 5 empty newsgroup face."
503 :group 'gnus-group)
0f49874b
MB
504;; backward-compatibility alias
505(put 'gnus-group-news-5-empty-face 'face-alias 'gnus-group-news-5-empty)
16409b0b 506
0f49874b 507(defface gnus-group-news-6
16409b0b
GM
508 '((((class color)
509 (background dark))
23f87bed 510 (:bold t))
16409b0b
GM
511 (((class color)
512 (background light))
23f87bed 513 (:bold t))
16409b0b
GM
514 (t
515 ()))
d0859c9a
MB
516 "Level 6 newsgroup face."
517 :group 'gnus-group)
0f49874b
MB
518;; backward-compatibility alias
519(put 'gnus-group-news-6-face 'face-alias 'gnus-group-news-6)
16409b0b 520
0f49874b 521(defface gnus-group-news-6-empty
16409b0b
GM
522 '((((class color)
523 (background dark))
524 ())
525 (((class color)
526 (background light))
527 ())
528 (t
529 ()))
d0859c9a
MB
530 "Level 6 empty newsgroup face."
531 :group 'gnus-group)
0f49874b
MB
532;; backward-compatibility alias
533(put 'gnus-group-news-6-empty-face 'face-alias 'gnus-group-news-6-empty)
16409b0b 534
0f49874b 535(defface gnus-group-news-low
eec82323
LMI
536 '((((class color)
537 (background dark))
23f87bed 538 (:foreground "DarkTurquoise" :bold t))
eec82323
LMI
539 (((class color)
540 (background light))
23f87bed 541 (:foreground "DarkGreen" :bold t))
eec82323
LMI
542 (t
543 ()))
d0859c9a
MB
544 "Low level newsgroup face."
545 :group 'gnus-group)
0f49874b
MB
546;; backward-compatibility alias
547(put 'gnus-group-news-low-face 'face-alias 'gnus-group-news-low)
eec82323 548
0f49874b 549(defface gnus-group-news-low-empty
eec82323
LMI
550 '((((class color)
551 (background dark))
552 (:foreground "DarkTurquoise"))
553 (((class color)
554 (background light))
555 (:foreground "DarkGreen"))
556 (t
557 ()))
d0859c9a
MB
558 "Low level empty newsgroup face."
559 :group 'gnus-group)
0f49874b
MB
560;; backward-compatibility alias
561(put 'gnus-group-news-low-empty-face 'face-alias 'gnus-group-news-low-empty)
eec82323 562
0f49874b 563(defface gnus-group-mail-1
eec82323
LMI
564 '((((class color)
565 (background dark))
01c52d31 566 (:foreground "#e1ffe1" :bold t))
eec82323
LMI
567 (((class color)
568 (background light))
23f87bed 569 (:foreground "DeepPink3" :bold t))
eec82323 570 (t
23f87bed 571 (:bold t)))
d0859c9a
MB
572 "Level 1 mailgroup face."
573 :group 'gnus-group)
0f49874b
MB
574;; backward-compatibility alias
575(put 'gnus-group-mail-1-face 'face-alias 'gnus-group-mail-1)
eec82323 576
0f49874b 577(defface gnus-group-mail-1-empty
eec82323
LMI
578 '((((class color)
579 (background dark))
01c52d31 580 (:foreground "#e1ffe1"))
eec82323
LMI
581 (((class color)
582 (background light))
583 (:foreground "DeepPink3"))
584 (t
23f87bed 585 (:italic t :bold t)))
d0859c9a
MB
586 "Level 1 empty mailgroup face."
587 :group 'gnus-group)
0f49874b
MB
588;; backward-compatibility alias
589(put 'gnus-group-mail-1-empty-face 'face-alias 'gnus-group-mail-1-empty)
eec82323 590
0f49874b 591(defface gnus-group-mail-2
eec82323
LMI
592 '((((class color)
593 (background dark))
01c52d31 594 (:foreground "DarkSeaGreen1" :bold t))
eec82323
LMI
595 (((class color)
596 (background light))
23f87bed 597 (:foreground "HotPink3" :bold t))
eec82323 598 (t
23f87bed 599 (:bold t)))
d0859c9a
MB
600 "Level 2 mailgroup face."
601 :group 'gnus-group)
0f49874b
MB
602;; backward-compatibility alias
603(put 'gnus-group-mail-2-face 'face-alias 'gnus-group-mail-2)
eec82323 604
0f49874b 605(defface gnus-group-mail-2-empty
eec82323
LMI
606 '((((class color)
607 (background dark))
01c52d31 608 (:foreground "DarkSeaGreen1"))
eec82323
LMI
609 (((class color)
610 (background light))
611 (:foreground "HotPink3"))
612 (t
23f87bed 613 (:bold t)))
d0859c9a
MB
614 "Level 2 empty mailgroup face."
615 :group 'gnus-group)
0f49874b
MB
616;; backward-compatibility alias
617(put 'gnus-group-mail-2-empty-face 'face-alias 'gnus-group-mail-2-empty)
eec82323 618
0f49874b 619(defface gnus-group-mail-3
eec82323
LMI
620 '((((class color)
621 (background dark))
01c52d31 622 (:foreground "aquamarine1" :bold t))
eec82323
LMI
623 (((class color)
624 (background light))
23f87bed 625 (:foreground "magenta4" :bold t))
eec82323 626 (t
23f87bed 627 (:bold t)))
d0859c9a
MB
628 "Level 3 mailgroup face."
629 :group 'gnus-group)
0f49874b
MB
630;; backward-compatibility alias
631(put 'gnus-group-mail-3-face 'face-alias 'gnus-group-mail-3)
eec82323 632
0f49874b 633(defface gnus-group-mail-3-empty
eec82323
LMI
634 '((((class color)
635 (background dark))
01c52d31 636 (:foreground "aquamarine1"))
eec82323
LMI
637 (((class color)
638 (background light))
639 (:foreground "magenta4"))
640 (t
641 ()))
d0859c9a
MB
642 "Level 3 empty mailgroup face."
643 :group 'gnus-group)
0f49874b
MB
644;; backward-compatibility alias
645(put 'gnus-group-mail-3-empty-face 'face-alias 'gnus-group-mail-3-empty)
eec82323 646
0f49874b 647(defface gnus-group-mail-low
eec82323
LMI
648 '((((class color)
649 (background dark))
01c52d31 650 (:foreground "aquamarine2" :bold t))
eec82323
LMI
651 (((class color)
652 (background light))
23f87bed 653 (:foreground "DeepPink4" :bold t))
eec82323 654 (t
23f87bed 655 (:bold t)))
d0859c9a
MB
656 "Low level mailgroup face."
657 :group 'gnus-group)
0f49874b
MB
658;; backward-compatibility alias
659(put 'gnus-group-mail-low-face 'face-alias 'gnus-group-mail-low)
eec82323 660
0f49874b 661(defface gnus-group-mail-low-empty
eec82323
LMI
662 '((((class color)
663 (background dark))
01c52d31 664 (:foreground "aquamarine2"))
eec82323
LMI
665 (((class color)
666 (background light))
667 (:foreground "DeepPink4"))
668 (t
23f87bed 669 (:bold t)))
d0859c9a
MB
670 "Low level empty mailgroup face."
671 :group 'gnus-group)
0f49874b
MB
672;; backward-compatibility alias
673(put 'gnus-group-mail-low-empty-face 'face-alias 'gnus-group-mail-low-empty)
eec82323
LMI
674
675;; Summary mode faces.
676
0f49874b 677(defface gnus-summary-selected '((t (:underline t)))
d0859c9a
MB
678 "Face used for selected articles."
679 :group 'gnus-summary)
0f49874b
MB
680;; backward-compatibility alias
681(put 'gnus-summary-selected-face 'face-alias 'gnus-summary-selected)
eec82323 682
0f49874b 683(defface gnus-summary-cancelled
eec82323
LMI
684 '((((class color))
685 (:foreground "yellow" :background "black")))
d0859c9a
MB
686 "Face used for cancelled articles."
687 :group 'gnus-summary)
0f49874b
MB
688;; backward-compatibility alias
689(put 'gnus-summary-cancelled-face 'face-alias 'gnus-summary-cancelled)
eec82323 690
0f49874b 691(defface gnus-summary-high-ticked
eec82323
LMI
692 '((((class color)
693 (background dark))
23f87bed 694 (:foreground "pink" :bold t))
eec82323
LMI
695 (((class color)
696 (background light))
23f87bed 697 (:foreground "firebrick" :bold t))
eec82323 698 (t
23f87bed 699 (:bold t)))
d0859c9a
MB
700 "Face used for high interest ticked articles."
701 :group 'gnus-summary)
0f49874b
MB
702;; backward-compatibility alias
703(put 'gnus-summary-high-ticked-face 'face-alias 'gnus-summary-high-ticked)
eec82323 704
0f49874b 705(defface gnus-summary-low-ticked
eec82323
LMI
706 '((((class color)
707 (background dark))
23f87bed 708 (:foreground "pink" :italic t))
eec82323
LMI
709 (((class color)
710 (background light))
23f87bed 711 (:foreground "firebrick" :italic t))
eec82323 712 (t
23f87bed 713 (:italic t)))
d0859c9a
MB
714 "Face used for low interest ticked articles."
715 :group 'gnus-summary)
0f49874b
MB
716;; backward-compatibility alias
717(put 'gnus-summary-low-ticked-face 'face-alias 'gnus-summary-low-ticked)
eec82323 718
0f49874b 719(defface gnus-summary-normal-ticked
eec82323
LMI
720 '((((class color)
721 (background dark))
722 (:foreground "pink"))
723 (((class color)
724 (background light))
725 (:foreground "firebrick"))
726 (t
727 ()))
d0859c9a
MB
728 "Face used for normal interest ticked articles."
729 :group 'gnus-summary)
0f49874b
MB
730;; backward-compatibility alias
731(put 'gnus-summary-normal-ticked-face 'face-alias 'gnus-summary-normal-ticked)
eec82323 732
0f49874b 733(defface gnus-summary-high-ancient
eec82323
LMI
734 '((((class color)
735 (background dark))
23f87bed 736 (:foreground "SkyBlue" :bold t))
eec82323
LMI
737 (((class color)
738 (background light))
23f87bed 739 (:foreground "RoyalBlue" :bold t))
eec82323 740 (t
23f87bed 741 (:bold t)))
d0859c9a
MB
742 "Face used for high interest ancient articles."
743 :group 'gnus-summary)
0f49874b
MB
744;; backward-compatibility alias
745(put 'gnus-summary-high-ancient-face 'face-alias 'gnus-summary-high-ancient)
eec82323 746
0f49874b 747(defface gnus-summary-low-ancient
eec82323
LMI
748 '((((class color)
749 (background dark))
23f87bed 750 (:foreground "SkyBlue" :italic t))
eec82323
LMI
751 (((class color)
752 (background light))
23f87bed 753 (:foreground "RoyalBlue" :italic t))
eec82323 754 (t
23f87bed 755 (:italic t)))
d0859c9a
MB
756 "Face used for low interest ancient articles."
757 :group 'gnus-summary)
0f49874b
MB
758;; backward-compatibility alias
759(put 'gnus-summary-low-ancient-face 'face-alias 'gnus-summary-low-ancient)
eec82323 760
0f49874b 761(defface gnus-summary-normal-ancient
eec82323
LMI
762 '((((class color)
763 (background dark))
764 (:foreground "SkyBlue"))
765 (((class color)
766 (background light))
767 (:foreground "RoyalBlue"))
768 (t
769 ()))
d0859c9a
MB
770 "Face used for normal interest ancient articles."
771 :group 'gnus-summary)
0f49874b
MB
772;; backward-compatibility alias
773(put 'gnus-summary-normal-ancient-face 'face-alias 'gnus-summary-normal-ancient)
eec82323 774
0f49874b 775(defface gnus-summary-high-undownloaded
23f87bed
MB
776 '((((class color)
777 (background light))
778 (:bold t :foreground "cyan4"))
779 (((class color) (background dark))
780 (:bold t :foreground "LightGray"))
781 (t (:inverse-video t :bold t)))
d0859c9a
MB
782 "Face used for high interest uncached articles."
783 :group 'gnus-summary)
0f49874b
MB
784;; backward-compatibility alias
785(put 'gnus-summary-high-undownloaded-face 'face-alias 'gnus-summary-high-undownloaded)
23f87bed 786
0f49874b 787(defface gnus-summary-low-undownloaded
23f87bed
MB
788 '((((class color)
789 (background light))
790 (:italic t :foreground "cyan4" :bold nil))
791 (((class color) (background dark))
792 (:italic t :foreground "LightGray" :bold nil))
793 (t (:inverse-video t :italic t)))
d0859c9a
MB
794 "Face used for low interest uncached articles."
795 :group 'gnus-summary)
0f49874b
MB
796;; backward-compatibility alias
797(put 'gnus-summary-low-undownloaded-face 'face-alias 'gnus-summary-low-undownloaded)
23f87bed 798
0f49874b 799(defface gnus-summary-normal-undownloaded
23f87bed
MB
800 '((((class color)
801 (background light))
802 (:foreground "cyan4" :bold nil))
803 (((class color) (background dark))
804 (:foreground "LightGray" :bold nil))
805 (t (:inverse-video t)))
d0859c9a
MB
806 "Face used for normal interest uncached articles."
807 :group 'gnus-summary)
0f49874b
MB
808;; backward-compatibility alias
809(put 'gnus-summary-normal-undownloaded-face 'face-alias 'gnus-summary-normal-undownloaded)
23f87bed 810
0f49874b 811(defface gnus-summary-high-unread
eec82323 812 '((t
23f87bed 813 (:bold t)))
d0859c9a
MB
814 "Face used for high interest unread articles."
815 :group 'gnus-summary)
0f49874b
MB
816;; backward-compatibility alias
817(put 'gnus-summary-high-unread-face 'face-alias 'gnus-summary-high-unread)
eec82323 818
0f49874b 819(defface gnus-summary-low-unread
eec82323 820 '((t
23f87bed 821 (:italic t)))
d0859c9a
MB
822 "Face used for low interest unread articles."
823 :group 'gnus-summary)
0f49874b
MB
824;; backward-compatibility alias
825(put 'gnus-summary-low-unread-face 'face-alias 'gnus-summary-low-unread)
eec82323 826
0f49874b 827(defface gnus-summary-normal-unread
eec82323
LMI
828 '((t
829 ()))
d0859c9a
MB
830 "Face used for normal interest unread articles."
831 :group 'gnus-summary)
0f49874b
MB
832;; backward-compatibility alias
833(put 'gnus-summary-normal-unread-face 'face-alias 'gnus-summary-normal-unread)
eec82323 834
0f49874b 835(defface gnus-summary-high-read
eec82323
LMI
836 '((((class color)
837 (background dark))
838 (:foreground "PaleGreen"
23f87bed 839 :bold t))
eec82323
LMI
840 (((class color)
841 (background light))
842 (:foreground "DarkGreen"
23f87bed 843 :bold t))
eec82323 844 (t
23f87bed 845 (:bold t)))
d0859c9a
MB
846 "Face used for high interest read articles."
847 :group 'gnus-summary)
0f49874b
MB
848;; backward-compatibility alias
849(put 'gnus-summary-high-read-face 'face-alias 'gnus-summary-high-read)
eec82323 850
0f49874b 851(defface gnus-summary-low-read
eec82323
LMI
852 '((((class color)
853 (background dark))
854 (:foreground "PaleGreen"
23f87bed 855 :italic t))
eec82323
LMI
856 (((class color)
857 (background light))
858 (:foreground "DarkGreen"
23f87bed 859 :italic t))
eec82323 860 (t
23f87bed 861 (:italic t)))
d0859c9a
MB
862 "Face used for low interest read articles."
863 :group 'gnus-summary)
0f49874b
MB
864;; backward-compatibility alias
865(put 'gnus-summary-low-read-face 'face-alias 'gnus-summary-low-read)
eec82323 866
0f49874b 867(defface gnus-summary-normal-read
eec82323
LMI
868 '((((class color)
869 (background dark))
870 (:foreground "PaleGreen"))
871 (((class color)
872 (background light))
873 (:foreground "DarkGreen"))
874 (t
875 ()))
d0859c9a
MB
876 "Face used for normal interest read articles."
877 :group 'gnus-summary)
0f49874b
MB
878;; backward-compatibility alias
879(put 'gnus-summary-normal-read-face 'face-alias 'gnus-summary-normal-read)
eec82323
LMI
880
881
6748645f
LMI
882;;;
883;;; Gnus buffers
884;;;
885
886(defvar gnus-buffers nil)
887
888(defun gnus-get-buffer-create (name)
889 "Do the same as `get-buffer-create', but store the created buffer."
890 (or (get-buffer name)
891 (car (push (get-buffer-create name) gnus-buffers))))
892
893(defun gnus-add-buffer ()
894 "Add the current buffer to the list of Gnus buffers."
895 (push (current-buffer) gnus-buffers))
896
23f87bed
MB
897(defmacro gnus-kill-buffer (buffer)
898 "Kill BUFFER and remove from the list of Gnus buffers."
899 `(let ((buf ,buffer))
900 (when (gnus-buffer-exists-p buf)
901 (setq gnus-buffers (delete (get-buffer buf) gnus-buffers))
902 (kill-buffer buf))))
903
6748645f
LMI
904(defun gnus-buffers ()
905 "Return a list of live Gnus buffers."
906 (while (and gnus-buffers
907 (not (buffer-name (car gnus-buffers))))
908 (pop gnus-buffers))
909 (let ((buffers gnus-buffers))
910 (while (cdr buffers)
911 (if (buffer-name (cadr buffers))
912 (pop buffers)
913 (setcdr buffers (cddr buffers)))))
914 gnus-buffers)
915
eec82323
LMI
916;;; Splash screen.
917
918(defvar gnus-group-buffer "*Group*")
919
920(eval-and-compile
921 (autoload 'gnus-play-jingle "gnus-audio"))
922
0f49874b 923(defface gnus-splash
eec82323
LMI
924 '((((class color)
925 (background dark))
01c52d31 926 (:foreground "#cccccc"))
eec82323
LMI
927 (((class color)
928 (background light))
23f87bed 929 (:foreground "#888888"))
eec82323
LMI
930 (t
931 ()))
d0859c9a 932 "Face for the splash screen."
3031d8b0 933 :group 'gnus-start)
0f49874b
MB
934;; backward-compatibility alias
935(put 'gnus-splash-face 'face-alias 'gnus-splash)
eec82323
LMI
936
937(defun gnus-splash ()
938 (save-excursion
6748645f 939 (switch-to-buffer (gnus-get-buffer-create gnus-group-buffer))
eec82323
LMI
940 (let ((buffer-read-only nil))
941 (erase-buffer)
942 (unless gnus-inhibit-startup-message
943 (gnus-group-startup-message)
944 (sit-for 0)
945 (when gnus-play-startup-jingle
946 (gnus-play-jingle))))))
947
948(defun gnus-indent-rigidly (start end arg)
949 "Indent rigidly using only spaces and no tabs."
950 (save-excursion
951 (save-restriction
952 (narrow-to-region start end)
a8151ef7
LMI
953 (let ((tab-width 8))
954 (indent-rigidly start end arg)
955 ;; We translate tabs into spaces -- not everybody uses
956 ;; an 8-character tab.
957 (goto-char (point-min))
958 (while (search-forward "\t" nil t)
959 (replace-match " " t t))))))
eec82323
LMI
960
961(defvar gnus-simple-splash nil)
962
23f87bed
MB
963;;(format "%02x%02x%02x" 114 66 20) "724214"
964
965(defvar gnus-logo-color-alist
966 '((flame "#cc3300" "#ff2200")
967 (pine "#c0cc93" "#f8ffb8")
968 (moss "#a1cc93" "#d2ffb8")
969 (irish "#04cc90" "#05ff97")
970 (sky "#049acc" "#05deff")
971 (tin "#6886cc" "#82b6ff")
972 (velvet "#7c68cc" "#8c82ff")
973 (grape "#b264cc" "#cf7df")
974 (labia "#cc64c2" "#fd7dff")
975 (berry "#cc6485" "#ff7db5")
976 (dino "#724214" "#1e3f03")
977 (oort "#cccccc" "#888888")
978 (storm "#666699" "#99ccff")
979 (pdino "#9999cc" "#99ccff")
980 (purp "#9999cc" "#666699")
01c52d31 981 (no "#ff0000" "#ffff00")
23f87bed
MB
982 (neutral "#b4b4b4" "#878787")
983 (september "#bf9900" "#ffcc00"))
984 "Color alist used for the Gnus logo.")
985
01c52d31 986(defcustom gnus-logo-color-style 'no
23f87bed
MB
987 "*Color styles used for the Gnus logo."
988 :type `(choice ,@(mapcar (lambda (elem) (list 'const (car elem)))
989 gnus-logo-color-alist))
990 :group 'gnus-xmas)
991
992(defvar gnus-logo-colors
993 (cdr (assq gnus-logo-color-style gnus-logo-color-alist))
994 "Colors used for the Gnus logo.")
995
eec82323
LMI
996(defun gnus-group-startup-message (&optional x y)
997 "Insert startup message in current buffer."
998 ;; Insert the message.
999 (erase-buffer)
16409b0b
GM
1000 (cond
1001 ((and
1002 (fboundp 'find-image)
1003 (display-graphic-p)
e9198520
MB
1004 ;; Make sure the library defining `image-load-path' is loaded
1005 ;; (`find-image' is autoloaded) (and discard the result). Else, we may
1006 ;; get "defvar ignored because image-load-path is let-bound" when calling
1007 ;; `find-image' below.
1008 (or (find-image '(nil (:type xpm :file "gnus.xpm"))) t)
d31fa104 1009 (let* ((data-directory (nnheader-find-etc-directory "images/gnus"))
430d3ed7
MB
1010 (image-load-path (cond (data-directory
1011 (list data-directory))
1012 ((boundp 'image-load-path)
1013 (symbol-value 'image-load-path))
1014 (t load-path)))
23f87bed
MB
1015 (image (find-image
1016 `((:type xpm :file "gnus.xpm"
1017 :color-symbols
1018 (("thing" . ,(car gnus-logo-colors))
1019 ("shadow" . ,(cadr gnus-logo-colors))
1020 ("oort" . "#eeeeee")
1021 ("background" . ,(face-background 'default))))
1022 (:type pbm :file "gnus.pbm"
1023 ;; Account for the pbm's blackground.
0f49874b 1024 :background ,(face-foreground 'gnus-splash)
23f87bed
MB
1025 :foreground ,(face-background 'default))
1026 (:type xbm :file "gnus.xbm"
1027 ;; Account for the xbm's blackground.
0f49874b 1028 :background ,(face-foreground 'gnus-splash)
23f87bed 1029 :foreground ,(face-background 'default))))))
16409b0b
GM
1030 (when image
1031 (let ((size (image-size image)))
1032 (insert-char ?\n (max 0 (round (- (window-height)
1033 (or y (cdr size)) 1) 2)))
1034 (insert-char ?\ (max 0 (round (- (window-width)
1035 (or x (car size))) 2)))
1036 (insert-image image))
1037 (setq gnus-simple-splash nil)
1038 t))))
1039 (t
1040 (insert
1041 (format " %s
01c52d31
MB
1042 _ ___ _ _
1043 _ ___ __ ___ __ _ ___
1044 __ _ ___ __ ___
1045 _ ___ _
1046 _ _ __ _
1047 ___ __ _
1048 __ _
1049 _ _ _
1050 _ _ _
1051 _ _ _
1052 __ ___
1053 _ _ _ _
1054 _ _
1055 _ _
1056 _ _
1057 _
1058 __
eec82323
LMI
1059
1060"
16409b0b
GM
1061 ""))
1062 ;; And then hack it.
1063 (gnus-indent-rigidly (point-min) (point-max)
1064 (/ (max (- (window-width) (or x 46)) 0) 2))
1065 (goto-char (point-min))
1066 (forward-line 1)
1067 (let* ((pheight (count-lines (point-min) (point-max)))
1068 (wheight (window-height))
1069 (rest (- wheight pheight)))
1070 (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
1071 ;; Fontify some.
0f49874b 1072 (put-text-property (point-min) (point-max) 'face 'gnus-splash)
16409b0b 1073 (setq gnus-simple-splash t)))
eec82323
LMI
1074 (goto-char (point-min))
1075 (setq mode-line-buffer-identification (concat " " gnus-version))
eec82323
LMI
1076 (set-buffer-modified-p t))
1077
1078(eval-when (load)
1079 (let ((command (format "%s" this-command)))
23f87bed
MB
1080 (when (string-match "gnus" command)
1081 (if (string-match "gnus-other-frame" command)
1082 (gnus-get-buffer-create gnus-group-buffer)
1083 (gnus-splash)))))
eec82323
LMI
1084
1085;;; Do the rest.
1086
eec82323
LMI
1087(require 'gnus-util)
1088(require 'nnheader)
1089
23f87bed
MB
1090(defcustom gnus-parameters nil
1091 "Alist of group parameters.
1092
1093For example:
1094 ((\"mail\\\\..*\" (gnus-show-threads nil)
1095 (gnus-use-scoring nil)
1096 (gnus-summary-line-format
1097 \"%U%R%z%I%(%[%d:%ub%-23,23f%]%) %s\\n\")
1098 (gcc-self . t)
1099 (display . all))
1100 (\"mail\\\\.me\" (gnus-use-scoring t))
1101 (\"list\\\\..*\" (total-expire . t)
1102 (broken-reply-to . t)))"
bf247b6e 1103 :version "22.1"
23f87bed
MB
1104 :group 'gnus-group-various
1105 :type '(repeat (cons regexp
1106 (repeat sexp))))
1107
e8beac8a
MB
1108(defcustom gnus-parameters-case-fold-search 'default
1109 "If it is t, ignore case of group names specified in `gnus-parameters'.
1110If it is nil, don't ignore case. If it is `default', which is for the
1111backward compatibility, use the value of `case-fold-search'."
1112 :version "22.1"
1113 :group 'gnus-group-various
1114 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
1115 (const :tag "Use `case-fold-search'" default)
1116 (const nil)
1117 (const t)))
1118
23f87bed
MB
1119(defvar gnus-group-parameters-more nil)
1120
1121(defmacro gnus-define-group-parameter (param &rest rest)
1122 "Define a group parameter PARAM.
1123REST is a plist of following:
1124:type One of `bool', `list' or nil.
1125:function The name of the function.
1126:function-document The documentation of the function.
1127:parameter-type The type for customizing the parameter.
1128:parameter-document The documentation for the parameter.
1129:variable The name of the variable.
1130:variable-document The documentation for the variable.
1131:variable-group The group for customizing the variable.
1132:variable-type The type for customizing the variable.
1133:variable-default The default value of the variable."
1134 (let* ((type (plist-get rest :type))
1135 (parameter-type (plist-get rest :parameter-type))
1136 (parameter-document (plist-get rest :parameter-document))
1137 (function (or (plist-get rest :function)
1138 (intern (format "gnus-parameter-%s" param))))
1139 (function-document (or (plist-get rest :function-document) ""))
1140 (variable (or (plist-get rest :variable)
1141 (intern (format "gnus-parameter-%s-alist" param))))
1142 (variable-document (or (plist-get rest :variable-document) ""))
1143 (variable-group (plist-get rest :variable-group))
1144 (variable-type (or (plist-get rest :variable-type)
1145 `(quote (repeat
1146 (list (regexp :tag "Group")
1147 ,(car (cdr parameter-type)))))))
1148 (variable-default (plist-get rest :variable-default)))
1149 (list
1150 'progn
1151 `(defcustom ,variable ,variable-default
1152 ,variable-document
1153 :group 'gnus-group-parameter
1154 :group ',variable-group
1155 :type ,variable-type)
1156 `(setq gnus-group-parameters-more
1157 (delq (assq ',param gnus-group-parameters-more)
1158 gnus-group-parameters-more))
1159 `(add-to-list 'gnus-group-parameters-more
1160 (list ',param
1161 ,parameter-type
1162 ,parameter-document))
1163 (if (eq type 'bool)
1164 `(defun ,function (name)
1165 ,function-document
1166 (let ((params (gnus-group-find-parameter name))
1167 val)
1168 (cond
1169 ((memq ',param params)
1170 t)
1171 ((setq val (assq ',param params))
1172 (cdr val))
1173 ((stringp ,variable)
1174 (string-match ,variable name))
1175 (,variable
1176 (let ((alist ,variable)
1177 elem value)
1178 (while (setq elem (pop alist))
1179 (when (and name
1180 (string-match (car elem) name))
1181 (setq alist nil
1182 value (cdr elem))))
1183 (if (consp value) (car value) value))))))
1184 `(defun ,function (name)
1185 ,function-document
1186 (and name
1187 (or (gnus-group-find-parameter name ',param ,(and type t))
1188 (let ((alist ,variable)
1189 elem value)
1190 (while (setq elem (pop alist))
1191 (when (and name
1192 (string-match (car elem) name))
1193 (setq alist nil
1194 value (cdr elem))))
1195 ,(if type
1196 'value
1197 '(if (consp value) (car value) value))))))))))
1198
eec82323
LMI
1199(defcustom gnus-home-directory "~/"
1200 "Directory variable that specifies the \"home\" directory.
35ef97a5 1201All other Gnus file and directory variables are initialized from this variable."
eec82323
LMI
1202 :group 'gnus-files
1203 :type 'directory)
1204
1205(defcustom gnus-directory (or (getenv "SAVEDIR")
1206 (nnheader-concat gnus-home-directory "News/"))
6748645f
LMI
1207 "*Directory variable from which all other Gnus file variables are derived.
1208
1209Note that Gnus is mostly loaded when the `.gnus.el' file is read.
1210This means that other directory variables that are initialized from
1211this variable won't be set properly if you set this variable in `.gnus.el'.
1212Set this variable in `.emacs' instead."
eec82323
LMI
1213 :group 'gnus-files
1214 :type 'directory)
1215
1216(defcustom gnus-default-directory nil
1217 "*Default directory for all Gnus buffers."
1218 :group 'gnus-files
1219 :type '(choice (const :tag "current" nil)
1220 directory))
1221
1222;; Site dependent variables. These variables should be defined in
1223;; paths.el.
1224
1225(defvar gnus-default-nntp-server nil
1226 "Specify a default NNTP server.
1227This variable should be defined in paths.el, and should never be set
1228by the user.
1229If you want to change servers, you should use `gnus-select-method'.
1230See the documentation to that variable.")
1231
1232;; Don't touch this variable.
1233(defvar gnus-nntp-service "nntp"
1234 "NNTP service name (\"nntp\" or 119).
1235This is an obsolete variable, which is scarcely used. If you use an
1236nntp server for your newsgroup and want to change the port number
1237used to 899, you would say something along these lines:
1238
1239 (setq gnus-select-method '(nntp \"my.nntp.server\" (nntp-port-number 899)))")
1240
1241(defcustom gnus-nntpserver-file "/etc/nntpserver"
1242 "A file with only the name of the nntp server in it."
1243 :group 'gnus-files
1244 :group 'gnus-server
1245 :type 'file)
1246
eec82323 1247(defun gnus-getenv-nntpserver ()
23f87bed
MB
1248 "Find default nntp server.
1249Check the NNTPSERVER environment variable and the
1250`gnus-nntpserver-file' file."
eec82323
LMI
1251 (or (getenv "NNTPSERVER")
1252 (and (file-readable-p gnus-nntpserver-file)
23f87bed 1253 (with-temp-buffer
eec82323 1254 (insert-file-contents gnus-nntpserver-file)
f4dd4ae8
MB
1255 (when (re-search-forward "[^ \t\n\r]+" nil t)
1256 (match-string 0))))))
eec82323 1257
4573e0df
MB
1258;; `M-x customize-variable RET gnus-select-method RET' should work without
1259;; starting or even loading Gnus.
1260;;;###autoload(when (fboundp 'custom-autoload)
1261;;;###autoload (custom-autoload 'gnus-select-method "gnus"))
1262
eec82323 1263(defcustom gnus-select-method
a36c8d02 1264 (condition-case nil
16409b0b
GM
1265 (nconc
1266 (list 'nntp (or (condition-case nil
1267 (gnus-getenv-nntpserver)
1268 (error nil))
1269 (when (and gnus-default-nntp-server
1270 (not (string= gnus-default-nntp-server "")))
1271 gnus-default-nntp-server)
1272 "news"))
1273 (if (or (null gnus-nntp-service)
1274 (equal gnus-nntp-service "nntp"))
1275 nil
1276 (list gnus-nntp-service)))
a36c8d02 1277 (error nil))
16409b0b 1278 "Default method for selecting a newsgroup.
eec82323
LMI
1279This variable should be a list, where the first element is how the
1280news is to be fetched, the second is the address.
1281
23f87bed
MB
1282For instance, if you want to get your news via \"flab.flab.edu\" using
1283NNTP, you could say:
eec82323
LMI
1284
1285\(setq gnus-select-method '(nntp \"flab.flab.edu\"))
1286
1287If you want to use your local spool, say:
1288
1289\(setq gnus-select-method (list 'nnspool (system-name)))
1290
1291If you use this variable, you must set `gnus-nntp-server' to nil.
1292
1293There is a lot more to know about select methods and virtual servers -
1294see the manual for details."
1295 :group 'gnus-server
4573e0df
MB
1296 :group 'gnus-start
1297 :initialize 'custom-initialize-default
eec82323
LMI
1298 :type 'gnus-select-method)
1299
23f87bed 1300(defcustom gnus-message-archive-method "archive"
6748645f 1301 "*Method used for archiving messages you've sent.
01c52d31
MB
1302This should be a mail method.
1303
1304See also `gnus-update-message-archive-method'."
eec82323
LMI
1305 :group 'gnus-server
1306 :group 'gnus-message
23f87bed
MB
1307 :type '(choice (const :tag "Default archive method" "archive")
1308 gnus-select-method))
eec82323 1309
01c52d31
MB
1310(defcustom gnus-update-message-archive-method nil
1311 "Non-nil means always update the saved \"archive\" method.
1312
1313The archive method is initially set according to the value of
1314`gnus-message-archive-method' and is saved in the \"~/.newsrc.eld\" file
1315so that it may be used as a real method of the server which is named
1316\"archive\" ever since. If it once has been saved, it will never be
1317updated if the value of this variable is nil, even if you change the
1318value of `gnus-message-archive-method' afterward. If you want the
1319saved \"archive\" method to be updated whenever you change the value of
1320`gnus-message-archive-method', set this variable to a non-nil value."
330f707b 1321 :version "23.1" ;; No Gnus
01c52d31
MB
1322 :group 'gnus-server
1323 :group 'gnus-message
1324 :type 'boolean)
1325
eec82323
LMI
1326(defcustom gnus-message-archive-group nil
1327 "*Name of the group in which to save the messages you've written.
1328This can either be a string; a list of strings; or an alist
1329of regexps/functions/forms to be evaluated to return a string (or a list
1330of strings). The functions are called with the name of the current
1331group (or nil) as a parameter.
1332
1333If you want to save your mail in one group and the news articles you
1334write in another group, you could say something like:
1335
1336 \(setq gnus-message-archive-group
23f87bed
MB
1337 '((if (message-news-p)
1338 \"misc-news\"
1339 \"misc-mail\")))
eec82323
LMI
1340
1341Normally the group names returned by this variable should be
1342unprefixed -- which implicitly means \"store on the archive server\".
1343However, you may wish to store the message on some other server. In
1344that case, just return a fully prefixed name of the group --
1345\"nnml+private:mail.misc\", for instance."
1346 :group 'gnus-message
1347 :type '(choice (const :tag "none" nil)
16409b0b 1348 function
6748645f 1349 sexp
eec82323
LMI
1350 string))
1351
1352(defcustom gnus-secondary-servers nil
1353 "List of NNTP servers that the user can choose between interactively.
1354To make Gnus query you for a server, you have to give `gnus' a
1355non-numeric prefix - `C-u M-x gnus', in short."
1356 :group 'gnus-server
1357 :type '(repeat string))
1358
1359(defcustom gnus-nntp-server nil
1360 "*The name of the host running the NNTP server.
65a32076 1361This variable is semi-obsolete. Use the `gnus-select-method'
eec82323
LMI
1362variable instead."
1363 :group 'gnus-server
1364 :type '(choice (const :tag "disable" nil)
1365 string))
1366
1367(defcustom gnus-secondary-select-methods nil
1368 "A list of secondary methods that will be used for reading news.
1369This is a list where each element is a complete select method (see
1370`gnus-select-method').
1371
23f87bed 1372If, for instance, you want to read your mail with the nnml back end,
eec82323
LMI
1373you could set this variable:
1374
1375\(setq gnus-secondary-select-methods '((nnml \"\")))"
16409b0b
GM
1376 :group 'gnus-server
1377 :type '(repeat gnus-select-method))
eec82323
LMI
1378
1379(defvar gnus-backup-default-subscribed-newsgroups
1380 '("news.announce.newusers" "news.groups.questions" "gnu.emacs.gnus")
1381 "Default default new newsgroups the first time Gnus is run.
1382Should be set in paths.el, and shouldn't be touched by the user.")
1383
c625688c
GM
1384(defcustom gnus-local-domain nil
1385 "Local domain name without a host name.
1386The DOMAINNAME environment variable is used instead if it is defined.
0d54d415 1387If the function `system-name' returns the full Internet name, there is
c625688c
GM
1388no need to set this variable."
1389 :group 'gnus-message
1390 :type '(choice (const :tag "default" nil)
1391 string))
1392
eec82323
LMI
1393(defvar gnus-local-organization nil
1394 "String with a description of what organization (if any) the user belongs to.
1395Obsolete variable; use `message-user-organization' instead.")
1396
1397;; Customization variables
1398
1399(defcustom gnus-refer-article-method nil
1400 "Preferred method for fetching an article by Message-ID.
1401If you are reading news from the local spool (with nnspool), fetching
1402articles by Message-ID is painfully slow. By setting this method to an
1403nntp method, you might get acceptable results.
1404
1405The value of this variable must be a valid select method as discussed
16409b0b
GM
1406in the documentation of `gnus-select-method'.
1407
1408It can also be a list of select methods, as well as the special symbol
1409`current', which means to use the current select method. If it is a
1410list, Gnus will try all the methods in the list until it finds a match."
eec82323
LMI
1411 :group 'gnus-server
1412 :type '(choice (const :tag "default" nil)
23f87bed
MB
1413 (const current)
1414 (const :tag "Google" (nnweb "refer" (nnweb-type google)))
16409b0b
GM
1415 gnus-select-method
1416 (repeat :menu-tag "Try multiple"
1417 :tag "Multiple"
23f87bed 1418 :value (current (nnweb "refer" (nnweb-type google)))
16409b0b
GM
1419 (choice :tag "Method"
1420 (const current)
23f87bed
MB
1421 (const :tag "Google"
1422 (nnweb "refer" (nnweb-type google)))
16409b0b 1423 gnus-select-method))))
eec82323
LMI
1424
1425(defcustom gnus-group-faq-directory
1426 '("/ftp@mirrors.aol.com:/pub/rtfm/usenet/"
eec82323
LMI
1427 "/ftp@sunsite.doc.ic.ac.uk:/pub/usenet/news-faqs/"
1428 "/ftp@src.doc.ic.ac.uk:/usenet/news-FAQS/"
1429 "/ftp@ftp.seas.gwu.edu:/pub/rtfm/"
23f87bed 1430 "/ftp@ftp.pasteur.fr:/pub/FAQ/"
eec82323
LMI
1431 "/ftp@rtfm.mit.edu:/pub/usenet/"
1432 "/ftp@ftp.uni-paderborn.de:/pub/FAQ/"
1433 "/ftp@ftp.sunet.se:/pub/usenet/"
23f87bed 1434 "/ftp@nctuccca.nctu.edu.tw:/pub/Documents/rtfm/usenet-by-group/"
eec82323
LMI
1435 "/ftp@hwarang.postech.ac.kr:/pub/usenet/"
1436 "/ftp@ftp.hk.super.net:/mirror/faqs/")
6748645f 1437 "*Directory where the group FAQs are stored.
eec82323
LMI
1438This will most commonly be on a remote machine, and the file will be
1439fetched by ange-ftp.
1440
1441This variable can also be a list of directories. In that case, the
1442first element in the list will be used by default. The others can
1443be used when being prompted for a site.
1444
1445Note that Gnus uses an aol machine as the default directory. If this
1446feels fundamentally unclean, just think of it as a way to finally get
1447something of value back from them.
1448
1449If the default site is too slow, try one of these:
1450
1451 North America: mirrors.aol.com /pub/rtfm/usenet
1452 ftp.seas.gwu.edu /pub/rtfm
1453 rtfm.mit.edu /pub/usenet
1454 Europe: ftp.uni-paderborn.de /pub/FAQ
23f87bed 1455 src.doc.ic.ac.uk /usenet/news-FAQS
eec82323 1456 ftp.sunet.se /pub/usenet
23f87bed
MB
1457 ftp.pasteur.fr /pub/FAQ
1458 Asia: nctuccca.nctu.edu.tw /pub/Documents/rtfm/usenet-by-group/
eec82323
LMI
1459 hwarang.postech.ac.kr /pub/usenet
1460 ftp.hk.super.net /mirror/faqs"
1461 :group 'gnus-group-various
1462 :type '(choice directory
1463 (repeat directory)))
1464
23f87bed
MB
1465(defcustom gnus-group-charter-alist
1466 '(("no" . (concat "http://no.news-admin.org/charter/" name ".txt"))
1467 ("de" . (concat "http://purl.net/charta/" name ".html"))
1468 ("dk" . (concat "http://www.usenet.dk/grupper.pl?get=" name))
1469 ("england" . (concat "http://england.news-admin.org/charters/" name))
1470 ("fr" . (concat "http://www.usenet-fr.net/fur/chartes/" name ".html"))
1471 ("europa" . (concat "http://www.europa.usenet.eu.org/chartas/charta-en-"
1472 (gnus-replace-in-string name "europa\\." "") ".html"))
1473 ("nl" . (concat "http://www.xs4all.nl/~sister/usenet/charters/" name))
1474 ("aus" . (concat "http://aus.news-admin.org/groupinfo.cgi/" name))
1475 ("pl" . (concat "http://www.usenet.pl/opisy/" name))
1476 ("ch" . (concat "http://www.use-net.ch/Usenet/charter.html#" name))
1477 ("at" . (concat "http://www.usenet.at/chartas/" name "/charta"))
1478 ("uk" . (concat "http://www.usenet.org.uk/" name ".html"))
1479 ("dfw" . (concat "http://www.cirr.com/dfw/charters/" name ".html"))
1480 ("se" . (concat "http://www.usenet-se.net/Reglementen/"
1481 (gnus-replace-in-string name "\\." "_") ".html"))
1482 ("milw" . (concat "http://usenet.mil.wi.us/"
1483 (gnus-replace-in-string name "milw\\." "") "-charter"))
1484 ("ca" . (concat "http://www.sbay.org/ca/charter-" name ".html"))
1485 ("netins" . (concat "http://www.netins.net/usenet/charter/"
1486 (gnus-replace-in-string name "\\." "-") "-charter.html")))
1487 "*An alist of (HIERARCHY . FORM) pairs used to construct the URL of a charter.
1488When FORM is evaluated `name' is bound to the name of the group."
bf247b6e 1489 :version "22.1"
23f87bed
MB
1490 :group 'gnus-group-various
1491 :type '(repeat (cons (string :tag "Hierarchy") (sexp :tag "Form"))))
60ece9b0 1492(put 'gnus-group-charter-alist 'risky-local-variable t)
23f87bed
MB
1493
1494(defcustom gnus-group-fetch-control-use-browse-url nil
1495 "*Non-nil means that control messages are displayed using `browse-url'.
1496Otherwise they are fetched with ange-ftp and displayed in an ephemeral
1497group."
bf247b6e 1498 :version "22.1"
23f87bed
MB
1499 :group 'gnus-group-various
1500 :type 'boolean)
1501
eec82323
LMI
1502(defcustom gnus-use-cross-reference t
1503 "*Non-nil means that cross referenced articles will be marked as read.
1504If nil, ignore cross references. If t, mark articles as read in
65a32076 1505subscribed newsgroups. If neither t nor nil, mark as read in all
eec82323
LMI
1506newsgroups."
1507 :group 'gnus-server
1508 :type '(choice (const :tag "off" nil)
1509 (const :tag "subscribed" t)
1510 (sexp :format "all"
1511 :value always)))
1512
1513(defcustom gnus-process-mark ?#
1514 "*Process mark."
1515 :group 'gnus-group-visual
1516 :group 'gnus-summary-marks
1517 :type 'character)
1518
eec82323
LMI
1519(defcustom gnus-large-newsgroup 200
1520 "*The number of articles which indicates a large newsgroup.
1521If the number of articles in a newsgroup is greater than this value,
23f87bed
MB
1522confirmation is required for selecting the newsgroup.
1523If it is nil, no confirmation is required."
eec82323 1524 :group 'gnus-group-select
23f87bed
MB
1525 :type '(choice (const :tag "No limit" nil)
1526 integer))
eec82323 1527
f3041af1 1528(defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v)))
eec82323
LMI
1529 "*Non-nil means that the default name of a file to save articles in is the group name.
1530If it's nil, the directory form of the group name is used instead.
1531
1532If this variable is a list, and the list contains the element
1533`not-score', long file names will not be used for score files; if it
1534contains the element `not-save', long file names will not be used for
1535saving; and if it contains the element `not-kill', long file names
1536will not be used for kill files.
1537
1538Note that the default for this variable varies according to what system
1539type you're using. On `usg-unix-v' and `xenix' this variable defaults
1540to nil while on all other systems it defaults to t."
1541 :group 'gnus-start
23f87bed
MB
1542 :type '(radio (sexp :format "Non-nil\n"
1543 :match (lambda (widget value)
1544 (and value (not (listp value))))
1545 :value t)
1546 (const nil)
1547 (checklist (const :format "%v " not-score)
1548 (const :format "%v " not-save)
1549 (const not-kill))))
eec82323
LMI
1550
1551(defcustom gnus-kill-files-directory gnus-directory
1552 "*Name of the directory where kill files will be stored (default \"~/News\")."
1553 :group 'gnus-score-files
1554 :group 'gnus-score-kill
1555 :type 'directory)
1556
1557(defcustom gnus-save-score nil
1558 "*If non-nil, save group scoring info."
1559 :group 'gnus-score-various
1560 :group 'gnus-start
1561 :type 'boolean)
1562
1563(defcustom gnus-use-undo t
1564 "*If non-nil, allow undoing in Gnus group mode buffers."
1565 :group 'gnus-meta
1566 :type 'boolean)
1567
1568(defcustom gnus-use-adaptive-scoring nil
1569 "*If non-nil, use some adaptive scoring scheme.
1570If a list, then the values `word' and `line' are meaningful. The
1571former will perform adaption on individual words in the subject
1572header while `line' will perform adaption on several headers."
1573 :group 'gnus-meta
1574 :group 'gnus-score-adapt
1575 :type '(set (const word) (const line)))
1576
1577(defcustom gnus-use-cache 'passive
1578 "*If nil, Gnus will ignore the article cache.
1579If `passive', it will allow entering (and reading) articles
1580explicitly entered into the cache. If anything else, use the
1581cache to the full extent of the law."
1582 :group 'gnus-meta
1583 :group 'gnus-cache
1584 :type '(choice (const :tag "off" nil)
1585 (const :tag "passive" passive)
1586 (const :tag "active" t)))
1587
1588(defcustom gnus-use-trees nil
1589 "*If non-nil, display a thread tree buffer."
1590 :group 'gnus-meta
1591 :type 'boolean)
1592
23f87bed 1593(defcustom gnus-keep-backlog 20
eec82323
LMI
1594 "*If non-nil, Gnus will keep read articles for later re-retrieval.
1595If it is a number N, then Gnus will only keep the last N articles
1596read. If it is neither nil nor a number, Gnus will keep all read
1597articles. This is not a good idea."
1598 :group 'gnus-meta
1599 :type '(choice (const :tag "off" nil)
1600 integer
1601 (sexp :format "all"
1602 :value t)))
1603
1604(defcustom gnus-use-nocem nil
ea8ae765
MB
1605 "*If non-nil, Gnus will read NoCeM cancel messages.
1606You can also set this variable to a positive number as a group level.
1607In that case, Gnus scans NoCeM messages when checking new news if this
1608value is not exceeding a group level that you specify as the prefix
1609argument to some commands, e.g. `gnus', `gnus-group-get-new-news', etc.
1610Otherwise, Gnus does not scan NoCeM messages if you specify a group
1611level to those commands."
eec82323 1612 :group 'gnus-meta
ea8ae765
MB
1613 :type '(choice
1614 (const :tag "off" nil)
1615 (const :tag "on" t)
1616 (list :convert-widget
1617 (lambda (widget)
1618 (list 'integer :tag "group level"
1619 :value (if (boundp 'gnus-level-default-subscribed)
1620 gnus-level-default-subscribed
1621 3))))))
eec82323
LMI
1622
1623(defcustom gnus-suppress-duplicates nil
1624 "*If non-nil, Gnus will mark duplicate copies of the same article as read."
1625 :group 'gnus-meta
1626 :type 'boolean)
1627
eec82323
LMI
1628(defcustom gnus-use-scoring t
1629 "*If non-nil, enable scoring."
1630 :group 'gnus-meta
1631 :type 'boolean)
1632
eec82323
LMI
1633(defcustom gnus-summary-prepare-exit-hook
1634 '(gnus-summary-expire-articles)
6748645f 1635 "*A hook called when preparing to exit from the summary buffer.
eec82323
LMI
1636It calls `gnus-summary-expire-articles' by default."
1637 :group 'gnus-summary-exit
1638 :type 'hook)
1639
1640(defcustom gnus-novice-user t
23f87bed 1641 "*Non-nil means that you are a Usenet novice.
eec82323
LMI
1642If non-nil, verbose messages may be displayed and confirmations may be
1643required."
1644 :group 'gnus-meta
1645 :type 'boolean)
1646
1647(defcustom gnus-expert-user nil
1648 "*Non-nil means that you will never be asked for confirmation about anything.
6748645f
LMI
1649That doesn't mean *anything* anything; particularly destructive
1650commands will still require prompting."
eec82323
LMI
1651 :group 'gnus-meta
1652 :type 'boolean)
1653
1654(defcustom gnus-interactive-catchup t
1655 "*If non-nil, require your confirmation when catching up a group."
1656 :group 'gnus-group-select
1657 :type 'boolean)
1658
1659(defcustom gnus-interactive-exit t
1660 "*If non-nil, require your confirmation when exiting Gnus."
1661 :group 'gnus-exit
1662 :type 'boolean)
1663
1664(defcustom gnus-extract-address-components 'gnus-extract-address-components
1665 "*Function for extracting address components from a From header.
1666Two pre-defined function exist: `gnus-extract-address-components',
1667which is the default, quite fast, and too simplistic solution, and
1668`mail-extract-address-components', which works much better, but is
1669slower."
1670 :group 'gnus-summary-format
1671 :type '(radio (function-item gnus-extract-address-components)
1672 (function-item mail-extract-address-components)
1673 (function :tag "Other")))
1674
1675(defcustom gnus-carpal nil
1676 "*If non-nil, display clickable icons."
1677 :group 'gnus-meta
1678 :type 'boolean)
1679
1680(defcustom gnus-shell-command-separator ";"
23f87bed 1681 "String used to separate shell commands."
eec82323
LMI
1682 :group 'gnus-files
1683 :type 'string)
1684
1685(defcustom gnus-valid-select-methods
1686 '(("nntp" post address prompt-address physical-address)
1687 ("nnspool" post address)
1688 ("nnvirtual" post-mail virtual prompt-address)
1689 ("nnmbox" mail respool address)
23f87bed 1690 ("nnml" post-mail respool address)
eec82323
LMI
1691 ("nnmh" mail respool address)
1692 ("nndir" post-mail prompt-address physical-address)
1693 ("nneething" none address prompt-address physical-address)
1694 ("nndoc" none address prompt-address)
1695 ("nnbabyl" mail address respool)
1696 ("nnkiboze" post virtual)
1697 ("nnsoup" post-mail address)
1698 ("nndraft" post-mail)
1699 ("nnfolder" mail respool address)
6748645f
LMI
1700 ("nngateway" post-mail address prompt-address physical-address)
1701 ("nnweb" none)
23f87bed 1702 ("nngoogle" post)
16409b0b
GM
1703 ("nnslashdot" post)
1704 ("nnultimate" none)
23f87bed
MB
1705 ("nnrss" none)
1706 ("nnwfm" none)
16409b0b 1707 ("nnwarchive" none)
6748645f 1708 ("nnlistserv" none)
16409b0b 1709 ("nnagent" post-mail)
23f87bed
MB
1710 ("nnimap" post-mail address prompt-address physical-address)
1711 ("nnmaildir" mail respool address)
1712 ("nnnil" none))
6748645f 1713 "*An alist of valid select methods.
eec82323
LMI
1714The first element of each list lists should be a string with the name
1715of the select method. The other elements may be the category of
1716this method (i. e., `post', `mail', `none' or whatever) or other
1717properties that this method has (like being respoolable).
1718If you implement a new select method, all you should have to change is
65a32076 1719this variable. I think."
eec82323
LMI
1720 :group 'gnus-server
1721 :type '(repeat (group (string :tag "Name")
1722 (radio-button-choice (const :format "%v " post)
1723 (const :format "%v " mail)
1724 (const :format "%v " none)
1725 (const post-mail))
1726 (checklist :inline t
1727 (const :format "%v " address)
1728 (const :format "%v " prompt-address)
c06fc524 1729 (const :format "%v " physical-address)
eec82323
LMI
1730 (const :format "%v " virtual)
1731 (const respool)))))
1732
16409b0b
GM
1733(defun gnus-redefine-select-method-widget ()
1734 "Recomputes the select-method widget based on the value of
1735`gnus-valid-select-methods'."
1736 (define-widget 'gnus-select-method 'list
1737 "Widget for entering a select method."
1738 :value '(nntp "")
1739 :tag "Select Method"
1740 :args `((choice :tag "Method"
1741 ,@(mapcar (lambda (entry)
1742 (list 'const :format "%v\n"
1743 (intern (car entry))))
1744 gnus-valid-select-methods)
1745 (symbol :tag "other"))
1746 (string :tag "Address")
1747 (repeat :tag "Options"
1748 :inline t
1749 (list :format "%v"
1750 variable
23f87bed 1751 (sexp :tag "Value"))))))
16409b0b
GM
1752
1753(gnus-redefine-select-method-widget)
eec82323
LMI
1754
1755(defcustom gnus-updated-mode-lines '(group article summary tree)
1756 "List of buffers that should update their mode lines.
1757The list may contain the symbols `group', `article', `tree' and
1758`summary'. If the corresponding symbol is present, Gnus will keep
1759that mode line updated with information that may be pertinent.
1760If this variable is nil, screen refresh may be quicker."
1761 :group 'gnus-various
1762 :type '(set (const group)
1763 (const article)
1764 (const summary)
1765 (const tree)))
1766
1767;; Added by Keinonen Kari <kk85613@cs.tut.fi>.
1768(defcustom gnus-mode-non-string-length nil
1769 "*Max length of mode-line non-string contents.
1770If this is nil, Gnus will take space as is needed, leaving the rest
23f87bed 1771of the mode line intact. Note that the default of nil is unlikely
eec82323
LMI
1772to be desirable; see the manual for further details."
1773 :group 'gnus-various
1774 :type '(choice (const nil)
1775 integer))
1776
23f87bed
MB
1777;; There should be special validation for this.
1778(define-widget 'gnus-email-address 'string
1779 "An email address.")
1780
1781(gnus-define-group-parameter
1782 to-address
1783 :function-document
1784 "Return GROUP's to-address."
1785 :variable-document
1786 "*Alist of group regexps and correspondent to-addresses."
e79f14a4 1787 :variable-group gnus-group-parameter
23f87bed
MB
1788 :parameter-type '(gnus-email-address :tag "To Address")
1789 :parameter-document "\
1790This will be used when doing followups and posts.
1791
1792This is primarily useful in mail groups that represent closed
1793mailing lists--mailing lists where it's expected that everybody that
1794writes to the mailing list is subscribed to it. Since using this
1795parameter ensures that the mail only goes to the mailing list itself,
1796it means that members won't receive two copies of your followups.
1797
1798Using `to-address' will actually work whether the group is foreign or
1799not. Let's say there's a group on the server that is called
1800`fa.4ad-l'. This is a real newsgroup, but the server has gotten the
1801articles from a mail-to-news gateway. Posting directly to this group
1802is therefore impossible--you have to send mail to the mailing list
1803address instead.
1804
1805The gnus-group-split mail splitting mechanism will behave as if this
1806address was listed in gnus-group-split Addresses (see below).")
1807
1808(gnus-define-group-parameter
1809 to-list
1810 :function-document
1811 "Return GROUP's to-list."
1812 :variable-document
1813 "*Alist of group regexps and correspondent to-lists."
e79f14a4 1814 :variable-group gnus-group-parameter
23f87bed
MB
1815 :parameter-type '(gnus-email-address :tag "To List")
1816 :parameter-document "\
1817This address will be used when doing a `a' in the group.
1818
1819It is totally ignored when doing a followup--except that if it is
1820present in a news group, you'll get mail group semantics when doing
1821`f'.
1822
1823The gnus-group-split mail splitting mechanism will behave as if this
1824address was listed in gnus-group-split Addresses (see below).")
1825
1826(gnus-define-group-parameter
1827 subscribed
1828 :type bool
1829 :function-document
1830 "Return GROUP's subscription status."
1831 :variable-document
1832 "*Groups which are automatically considered subscribed."
e79f14a4 1833 :variable-group gnus-group-parameter
23f87bed
MB
1834 :parameter-type '(const :tag "Subscribed" t)
1835 :parameter-document "\
1836Gnus assumed that you are subscribed to the To/List address.
1837
1838When constructing a list of subscribed groups using
1839`gnus-find-subscribed-addresses', Gnus includes the To address given
1840above, or the list address (if the To address has not been set).")
1841
1842(gnus-define-group-parameter
1843 auto-expire
1844 :type bool
1845 :function gnus-group-auto-expirable-p
1846 :function-document
1847 "Check whether GROUP is auto-expirable or not."
1848 :variable gnus-auto-expirable-newsgroups
1849 :variable-default nil
1850 :variable-document
1851 "*Groups in which to automatically mark read articles as expirable.
eec82323
LMI
1852If non-nil, this should be a regexp that should match all groups in
1853which to perform auto-expiry. This only makes sense for mail groups."
23f87bed
MB
1854 :variable-group nnmail-expire
1855 :variable-type '(choice (const nil)
1856 regexp)
1857 :parameter-type '(const :tag "Automatic Expire" t)
1858 :parameter-document
1859 "All articles that are read will be marked as expirable.")
1860
1861(gnus-define-group-parameter
1862 total-expire
1863 :type bool
1864 :function gnus-group-total-expirable-p
1865 :function-document
1866 "Check whether GROUP is total-expirable or not."
1867 :variable gnus-total-expirable-newsgroups
1868 :variable-default nil
1869 :variable-document
1870 "*Groups in which to perform expiry of all read articles.
eec82323
LMI
1871Use with extreme caution. All groups that match this regexp will be
1872expiring - which means that all read articles will be deleted after
65a32076 1873\(say) one week. (This only goes for mail groups and the like, of
eec82323 1874course.)"
23f87bed
MB
1875 :variable-group nnmail-expire
1876 :variable-type '(choice (const nil)
1877 regexp)
1878 :parameter-type '(const :tag "Total Expire" t)
1879 :parameter-document
1880 "All read articles will be put through the expiry process
1881
1882This happens even if they are not marked as expirable.
1883Use with caution.")
1884
1885(gnus-define-group-parameter
1886 charset
1887 :function-document
1888 "Return the default charset of GROUP."
1889 :variable gnus-group-charset-alist
1890 :variable-default
1891 '(("\\(^\\|:\\)hk\\>\\|\\(^\\|:\\)tw\\>\\|\\<big5\\>" cn-big5)
1892 ("\\(^\\|:\\)cn\\>\\|\\<chinese\\>" cn-gb-2312)
1893 ("\\(^\\|:\\)fj\\>\\|\\(^\\|:\\)japan\\>" iso-2022-jp-2)
1894 ("\\(^\\|:\\)tnn\\>\\|\\(^\\|:\\)pin\\>\\|\\(^\\|:\\)sci.lang.japan" iso-2022-7bit)
1895 ("\\(^\\|:\\)relcom\\>" koi8-r)
1896 ("\\(^\\|:\\)fido7\\>" koi8-r)
1897 ("\\(^\\|:\\)\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
1898 ("\\(^\\|:\\)israel\\>" iso-8859-1)
1899 ("\\(^\\|:\\)han\\>" euc-kr)
1900 ("\\(^\\|:\\)alt.chinese.text.big5\\>" chinese-big5)
1901 ("\\(^\\|:\\)soc.culture.vietnamese\\>" vietnamese-viqr)
1902 ("\\(^\\|:\\)\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1))
1903 :variable-document
1904 "Alist of regexps (to match group names) and default charsets to be used when reading."
1905 :variable-group gnus-charset
1906 :variable-type '(repeat (list (regexp :tag "Group")
1907 (symbol :tag "Charset")))
1908 :parameter-type '(symbol :tag "Charset")
1909 :parameter-document "\
1910The default charset to use in the group.")
1911
1912(gnus-define-group-parameter
1913 post-method
1914 :type list
1915 :function-document
1916 "Return a posting method for GROUP."
1917 :variable gnus-post-method-alist
1918 :variable-document
1919 "Alist of regexps (to match group names) and method to be used when
1920posting an article."
1921 :variable-group gnus-group-foreign
1922 :parameter-type
1923 '(choice :tag "Posting Method"
1924 (const :tag "Use native server" native)
1925 (const :tag "Use current server" current)
1926 (list :convert-widget
1927 (lambda (widget)
1928 (list 'sexp :tag "Methods"
1929 :value gnus-select-method))))
1930 :parameter-document
1931 "Posting method for this group.")
1932
1933(gnus-define-group-parameter
1934 large-newsgroup-initial
1935 :type integer
1936 :function-document
1937 "Return GROUP's initial input of the number of articles."
1938 :variable-document
1939 "*Alist of group regexps and its initial input of the number of articles."
e79f14a4 1940 :variable-group gnus-group-parameter
23f87bed
MB
1941 :parameter-type '(choice :tag "Initial Input for Large Newsgroup"
1942 (const :tag "All" nil)
1943 (integer))
1944 :parameter-document "\
1945
1946This number will be prompted as the initial value of the number of
1947articles to list when the group is a large newsgroup (see
1948`gnus-large-newsgroup'). If it is nil, the default value is the
1949total number of articles in the group.")
1950
1951;; The Gnus registry's ignored groups
1952(gnus-define-group-parameter
1953 registry-ignore
1954 :type list
1955 :function-document
1956 "Whether this group should be ignored by the registry."
1957 :variable gnus-registry-ignored-groups
1958 :variable-default nil
1959 :variable-document
1960 "*Groups in which the registry should be turned off."
1961 :variable-group gnus-registry
1962 :variable-type '(repeat
1963 (list
1964 (regexp :tag "Group Name Regular Expression")
1965 (boolean :tag "Ignored")))
bf247b6e 1966
23f87bed
MB
1967 :parameter-type '(boolean :tag "Group Ignored by the Registry")
1968 :parameter-document
1969 "Whether the Gnus Registry should ignore this group.")
1970
1971;; group parameters for spam processing added by Ted Zlatanov <tzz@lifelogs.com>
1972(defcustom gnus-install-group-spam-parameters t
1973 "*Disable the group parameters for spam detection.
1974Enable if `G c' in XEmacs is giving you trouble, and make sure to submit a bug report."
bf247b6e 1975 :version "22.1"
23f87bed
MB
1976 :type 'boolean
1977 :group 'gnus-start)
1978
1979(when gnus-install-group-spam-parameters
1980 (defvar gnus-group-spam-classification-spam t
1981 "Spam group classification (requires spam.el).
1982This group contains spam messages. On summary entry, unread messages
1983will be marked as spam. On summary exit, the specified spam
1984processors will be invoked on spam-marked messages, then those
1985messages will be expired, so the spam processor will only see a
1986spam-marked message once.")
1987
1988 (defvar gnus-group-spam-classification-ham 'ask
1989 "The ham value for the spam group parameter (requires spam.el).
1990On summary exit, the specified ham processors will be invoked on
1991ham-marked messages. Exercise caution, since the ham processor will
1992see the same message more than once because there is no ham message
1993registry.")
1994
1995 (gnus-define-group-parameter
1996 spam-contents
1997 :type list
1998 :function-document
1999 "The spam type (spam, ham, or neither) of the group."
2000 :variable gnus-spam-newsgroup-contents
2001 :variable-default nil
2002 :variable-document
270a576a
MB
2003 "*Group classification (spam, ham, or neither). Only
2004meaningful when spam.el is loaded. If non-nil, this should be a
2005list of group name regexps associated with a classification for
2006each one. In spam groups, new articles are marked as spam on
2007summary entry. There is other behavior associated with ham and
2008no classification when spam.el is loaded - see the manual."
23f87bed
MB
2009 :variable-group spam
2010 :variable-type '(repeat
2011 (list :tag "Group contents spam/ham classification"
2012 (regexp :tag "Group")
2013 (choice
2014 (variable-item gnus-group-spam-classification-spam)
2015 (variable-item gnus-group-spam-classification-ham)
2016 (const :tag "Unclassified" nil))))
2017
2018 :parameter-type '(list :tag "Group contents spam/ham classification"
2019 (choice :tag "Group contents classification for spam sorting"
2020 (variable-item gnus-group-spam-classification-spam)
2021 (variable-item gnus-group-spam-classification-ham)
2022 (const :tag "Unclassified" nil)))
2023 :parameter-document
2024 "The spam classification (spam, ham, or neither) of this group.
270a576a
MB
2025When a spam group is entered, all unread articles are marked as
2026spam. There is other behavior associated with ham and no
2027classification when spam.el is loaded - see the manual.")
23f87bed 2028
01c52d31
MB
2029 (gnus-define-group-parameter
2030 spam-resend-to
2031 :type list
2032 :function-document
2033 "The address to get spam resent (through spam-report-resend)."
2034 :variable gnus-spam-resend-to
2035 :variable-default nil
2036 :variable-document
2037 "The address to get spam resent (through spam-report-resend)."
2038 :variable-group spam
2039 :variable-type '(repeat
2040 (list :tag "Group address for resending spam"
2041 (regexp :tag "Group")
2042 (string :tag "E-mail address for resending spam (requires the spam-use-resend exit processor)")))
2043 :parameter-type 'string :tag "E-mail address for resending spam (requires the spam-use-resend exit processor)"
2044 :parameter-document
2045 "The address to get spam resent (through spam-report-resend).")
2046
2047 (gnus-define-group-parameter
2048 ham-resend-to
2049 :type list
2050 :function-document
2051 "The address to get ham resent (through spam-report-resend)."
2052 :variable gnus-ham-resend-to
2053 :variable-default nil
2054 :variable-document
2055 "The address to get ham resent (through spam-report-resend)."
2056 :variable-group spam
2057 :variable-type '(repeat
2058 (list :tag "Group address for resending ham"
2059 (regexp :tag "Group")
2060 (string :tag "E-mail address for resending ham (requires the spam-use-resend exit processor)")))
2061 :parameter-type 'string :tag "E-mail address for resending ham (requires the spam-use-resend exit processor)"
2062 :parameter-document
2063 "The address to get ham resent (through spam-report-resend).")
2064
23f87bed
MB
2065 (defvar gnus-group-spam-exit-processor-ifile "ifile"
2066 "OBSOLETE: The ifile summary exit spam processor.")
2067
2068 (defvar gnus-group-spam-exit-processor-stat "stat"
2069 "OBSOLETE: The spam-stat summary exit spam processor.")
2070
2071 (defvar gnus-group-spam-exit-processor-bogofilter "bogofilter"
2072 "OBSOLETE: The Bogofilter summary exit spam processor.")
2073
2074 (defvar gnus-group-spam-exit-processor-blacklist "blacklist"
2075 "OBSOLETE: The Blacklist summary exit spam processor.")
2076
2077 (defvar gnus-group-spam-exit-processor-report-gmane "report-gmane"
2078 "OBSOLETE: The Gmane reporting summary exit spam processor.
2079Only applicable to NNTP groups with articles from Gmane. See spam-report.el")
2080
2081 (defvar gnus-group-spam-exit-processor-spamoracle "spamoracle-spam"
2082 "OBSOLETE: The spamoracle summary exit spam processor.")
2083
2084 (defvar gnus-group-ham-exit-processor-ifile "ifile-ham"
2085 "OBSOLETE: The ifile summary exit ham processor.
2086Only applicable to non-spam (unclassified and ham) groups.")
2087
2088 (defvar gnus-group-ham-exit-processor-bogofilter "bogofilter-ham"
2089 "OBSOLETE: The Bogofilter summary exit ham processor.
2090Only applicable to non-spam (unclassified and ham) groups.")
2091
2092 (defvar gnus-group-ham-exit-processor-stat "stat-ham"
2093 "OBSOLETE: The spam-stat summary exit ham processor.
2094Only applicable to non-spam (unclassified and ham) groups.")
2095
2096 (defvar gnus-group-ham-exit-processor-whitelist "whitelist"
2097 "OBSOLETE: The whitelist summary exit ham processor.
2098Only applicable to non-spam (unclassified and ham) groups.")
2099
2100 (defvar gnus-group-ham-exit-processor-BBDB "bbdb"
2101 "OBSOLETE: The BBDB summary exit ham processor.
2102Only applicable to non-spam (unclassified and ham) groups.")
2103
2104 (defvar gnus-group-ham-exit-processor-copy "copy"
2105 "OBSOLETE: The ham copy exit ham processor.
2106Only applicable to non-spam (unclassified and ham) groups.")
2107
2108 (defvar gnus-group-ham-exit-processor-spamoracle "spamoracle-ham"
2109 "OBSOLETE: The spamoracle summary exit ham processor.
2110Only applicable to non-spam (unclassified and ham) groups.")
2111
2112 (gnus-define-group-parameter
2113 spam-process
2114 :type list
bf247b6e
KS
2115 :parameter-type
2116 '(choice
23f87bed
MB
2117 :tag "Spam Summary Exit Processor"
2118 :value nil
2119 (list :tag "Spam Summary Exit Processor Choices"
2120 (set
01c52d31
MB
2121 (const :tag "Spam: Bogofilter" (spam spam-use-bogofilter))
2122 (const :tag "Spam: Blacklist" (spam spam-use-blacklist))
2123 (const :tag "Spam: Bsfilter" (spam spam-use-bsfilter))
2124 (const :tag "Spam: Gmane Report" (spam spam-use-gmane))
2125 (const :tag "Spam: Resend Message"(spam spam-use-resend))
2126 (const :tag "Spam: ifile" (spam spam-use-ifile))
2127 (const :tag "Spam: Spam Oracle" (spam spam-use-spamoracle))
2128 (const :tag "Spam: Spam-stat" (spam spam-use-stat))
2129 (const :tag "Spam: SpamAssassin" (spam spam-use-spamassassin))
2130 (const :tag "Spam: CRM114" (spam spam-use-crm114))
2131 (const :tag "Ham: BBDB" (ham spam-use-BBDB))
2132 (const :tag "Ham: Bogofilter" (ham spam-use-bogofilter))
2133 (const :tag "Ham: Bsfilter" (ham spam-use-bsfilter))
2134 (const :tag "Ham: Copy" (ham spam-use-ham-copy))
2135 (const :tag "Ham: Resend Message" (ham spam-use-resend))
2136 (const :tag "Ham: ifile" (ham spam-use-ifile))
2137 (const :tag "Ham: Spam Oracle" (ham spam-use-spamoracle))
2138 (const :tag "Ham: Spam-stat" (ham spam-use-stat))
2139 (const :tag "Ham: SpamAssassin" (ham spam-use-spamassassin))
2140 (const :tag "Ham: CRM114" (ham spam-use-crm114))
2141 (const :tag "Ham: Whitelist" (ham spam-use-whitelist))
23f87bed
MB
2142 (variable-item gnus-group-spam-exit-processor-ifile)
2143 (variable-item gnus-group-spam-exit-processor-stat)
2144 (variable-item gnus-group-spam-exit-processor-bogofilter)
2145 (variable-item gnus-group-spam-exit-processor-blacklist)
2146 (variable-item gnus-group-spam-exit-processor-spamoracle)
2147 (variable-item gnus-group-spam-exit-processor-report-gmane)
2148 (variable-item gnus-group-ham-exit-processor-bogofilter)
2149 (variable-item gnus-group-ham-exit-processor-ifile)
2150 (variable-item gnus-group-ham-exit-processor-stat)
2151 (variable-item gnus-group-ham-exit-processor-whitelist)
2152 (variable-item gnus-group-ham-exit-processor-BBDB)
2153 (variable-item gnus-group-ham-exit-processor-spamoracle)
01c52d31 2154 (variable-item gnus-group-ham-exit-processor-copy))))
23f87bed
MB
2155 :function-document
2156 "Which spam or ham processors will be applied when the summary is exited."
2157 :variable gnus-spam-process-newsgroups
2158 :variable-default nil
2159 :variable-document
2160 "*Groups in which to automatically process spam or ham articles with
2161a backend on summary exit. If non-nil, this should be a list of group
2162name regexps that should match all groups in which to do automatic
2163spam processing, associated with the appropriate processor."
2164 :variable-group spam
bf247b6e 2165 :variable-type
23f87bed
MB
2166 '(repeat :tag "Spam/Ham Processors"
2167 (list :tag "Spam Summary Exit Processor Choices"
2168 (regexp :tag "Group Regexp")
bf247b6e 2169 (set
23f87bed 2170 :tag "Spam/Ham Summary Exit Processor"
01c52d31
MB
2171 (const :tag "Spam: Bogofilter" (spam spam-use-bogofilter))
2172 (const :tag "Spam: Blacklist" (spam spam-use-blacklist))
2173 (const :tag "Spam: Bsfilter" (spam spam-use-bsfilter))
2174 (const :tag "Spam: Gmane Report" (spam spam-use-gmane))
2175 (const :tag "Spam: Resend Message"(spam spam-use-resend))
2176 (const :tag "Spam: ifile" (spam spam-use-ifile))
2177 (const :tag "Spam: Spam-stat" (spam spam-use-stat))
2178 (const :tag "Spam: Spam Oracle" (spam spam-use-spamoracle))
2179 (const :tag "Spam: SpamAssassin" (spam spam-use-spamassassin))
2180 (const :tag "Spam: CRM114" (spam spam-use-crm114))
2181 (const :tag "Ham: BBDB" (ham spam-use-BBDB))
2182 (const :tag "Ham: Bogofilter" (ham spam-use-bogofilter))
2183 (const :tag "Ham: Bsfilter" (ham spam-use-bsfilter))
2184 (const :tag "Ham: Copy" (ham spam-use-ham-copy))
2185 (const :tag "Ham: Resend Message" (ham spam-use-resend))
2186 (const :tag "Ham: ifile" (ham spam-use-ifile))
2187 (const :tag "Ham: Spam-stat" (ham spam-use-stat))
2188 (const :tag "Ham: Spam Oracle" (ham spam-use-spamoracle))
2189 (const :tag "Ham: SpamAssassin" (ham spam-use-spamassassin))
2190 (const :tag "Ham: CRM114" (ham spam-use-crm114))
2191 (const :tag "Ham: Whitelist" (ham spam-use-whitelist))
23f87bed
MB
2192 (variable-item gnus-group-spam-exit-processor-ifile)
2193 (variable-item gnus-group-spam-exit-processor-stat)
2194 (variable-item gnus-group-spam-exit-processor-bogofilter)
2195 (variable-item gnus-group-spam-exit-processor-blacklist)
2196 (variable-item gnus-group-spam-exit-processor-spamoracle)
2197 (variable-item gnus-group-spam-exit-processor-report-gmane)
2198 (variable-item gnus-group-ham-exit-processor-bogofilter)
2199 (variable-item gnus-group-ham-exit-processor-ifile)
2200 (variable-item gnus-group-ham-exit-processor-stat)
2201 (variable-item gnus-group-ham-exit-processor-whitelist)
2202 (variable-item gnus-group-ham-exit-processor-BBDB)
2203 (variable-item gnus-group-ham-exit-processor-spamoracle)
01c52d31 2204 (variable-item gnus-group-ham-exit-processor-copy))))
23f87bed
MB
2205
2206 :parameter-document
2207 "Which spam or ham processors will be applied when the summary is exited.")
2208
2209 (gnus-define-group-parameter
2210 spam-autodetect
2211 :type list
bf247b6e 2212 :parameter-type
23f87bed
MB
2213 '(boolean :tag "Spam autodetection")
2214 :function-document
2215 "Should spam be autodetected (with spam-split) in this group?"
2216 :variable gnus-spam-autodetect
2217 :variable-default nil
2218 :variable-document
2219 "*Groups in which spam should be autodetected when they are entered.
2220 Only unseen articles will be examined, unless
2221 spam-autodetect-recheck-messages is set."
2222 :variable-group spam
bf247b6e 2223 :variable-type
23f87bed
MB
2224 '(repeat
2225 :tag "Autodetection setting"
2226 (list
2227 (regexp :tag "Group Regexp")
2228 boolean))
2229 :parameter-document
2230 "Spam autodetection.
2231Only unseen articles will be examined, unless
2232spam-autodetect-recheck-messages is set.")
2233
2234 (gnus-define-group-parameter
2235 spam-autodetect-methods
2236 :type list
bf247b6e 2237 :parameter-type
23f87bed
MB
2238 '(choice :tag "Spam autodetection-specific methods"
2239 (const none)
2240 (const default)
2241 (set :tag "Use specific methods"
2242 (variable-item spam-use-blacklist)
01c52d31 2243 (variable-item spam-use-gmane-xref)
23f87bed
MB
2244 (variable-item spam-use-regex-headers)
2245 (variable-item spam-use-regex-body)
2246 (variable-item spam-use-whitelist)
2247 (variable-item spam-use-BBDB)
2248 (variable-item spam-use-ifile)
2249 (variable-item spam-use-spamoracle)
01c52d31
MB
2250 (variable-item spam-use-crm114)
2251 (variable-item spam-use-spamassassin)
2252 (variable-item spam-use-spamassassin-headers)
2253 (variable-item spam-use-bsfilter)
2254 (variable-item spam-use-bsfilter-headers)
23f87bed
MB
2255 (variable-item spam-use-stat)
2256 (variable-item spam-use-blackholes)
2257 (variable-item spam-use-hashcash)
2258 (variable-item spam-use-bogofilter-headers)
2259 (variable-item spam-use-bogofilter)))
2260 :function-document
2261 "Methods to be used for autodetection in each group"
2262 :variable gnus-spam-autodetect-methods
2263 :variable-default nil
2264 :variable-document
2265 "*Methods for autodetecting spam per group.
2266Requires the spam-autodetect parameter. Only unseen articles
2267will be examined, unless spam-autodetect-recheck-messages is
2268set."
2269 :variable-group spam
bf247b6e 2270 :variable-type
23f87bed
MB
2271 '(repeat
2272 :tag "Autodetection methods"
2273 (list
2274 (regexp :tag "Group Regexp")
2275 (choice
2276 (const none)
2277 (const default)
2278 (set :tag "Use specific methods"
2279 (variable-item spam-use-blacklist)
01c52d31 2280 (variable-item spam-use-gmane-xref)
23f87bed
MB
2281 (variable-item spam-use-regex-headers)
2282 (variable-item spam-use-regex-body)
2283 (variable-item spam-use-whitelist)
2284 (variable-item spam-use-BBDB)
2285 (variable-item spam-use-ifile)
2286 (variable-item spam-use-spamoracle)
01c52d31 2287 (variable-item spam-use-crm114)
23f87bed
MB
2288 (variable-item spam-use-stat)
2289 (variable-item spam-use-blackholes)
2290 (variable-item spam-use-hashcash)
01c52d31
MB
2291 (variable-item spam-use-spamassassin)
2292 (variable-item spam-use-spamassassin-headers)
2293 (variable-item spam-use-bsfilter)
2294 (variable-item spam-use-bsfilter-headers)
23f87bed
MB
2295 (variable-item spam-use-bogofilter-headers)
2296 (variable-item spam-use-bogofilter)))))
2297 :parameter-document
bf247b6e 2298 "Spam autodetection methods.
23f87bed
MB
2299Requires the spam-autodetect parameter. Only unseen articles
2300will be examined, unless spam-autodetect-recheck-messages is
2301set.")
2302
2303 (gnus-define-group-parameter
2304 spam-process-destination
2305 :type list
bf247b6e 2306 :parameter-type
23f87bed
MB
2307 '(choice :tag "Destination for spam-processed articles at summary exit"
2308 (string :tag "Move to a group")
2309 (repeat :tag "Move to multiple groups"
2310 (string :tag "Destination group"))
2311 (const :tag "Expire" nil))
2312 :function-document
2313 "Where spam-processed articles will go at summary exit."
2314 :variable gnus-spam-process-destinations
2315 :variable-default nil
2316 :variable-document
2317 "*Groups in which to explicitly send spam-processed articles to
2318another group, or expire them (the default). If non-nil, this should
2319be a list of group name regexps that should match all groups in which
2320to do spam-processed article moving, associated with the destination
2321group or nil for explicit expiration. This only makes sense for
2322mail groups."
2323 :variable-group spam
bf247b6e 2324 :variable-type
23f87bed
MB
2325 '(repeat
2326 :tag "Spam-processed articles destination"
2327 (list
2328 (regexp :tag "Group Regexp")
2329 (choice
2330 :tag "Destination for spam-processed articles at summary exit"
2331 (string :tag "Move to a group")
2332 (repeat :tag "Move to multiple groups"
2333 (string :tag "Destination group"))
2334 (const :tag "Expire" nil))))
2335 :parameter-document
2336 "Where spam-processed articles will go at summary exit.")
bf247b6e 2337
23f87bed
MB
2338 (gnus-define-group-parameter
2339 ham-process-destination
2340 :type list
bf247b6e 2341 :parameter-type
23f87bed
MB
2342 '(choice
2343 :tag "Destination for ham articles at summary exit from a spam group"
2344 (string :tag "Move to a group")
2345 (repeat :tag "Move to multiple groups"
2346 (string :tag "Destination group"))
2347 (const :tag "Respool" respool)
2348 (const :tag "Do nothing" nil))
2349 :function-document
2350 "Where ham articles will go at summary exit from a spam group."
2351 :variable gnus-ham-process-destinations
2352 :variable-default nil
2353 :variable-document
2354 "*Groups in which to explicitly send ham articles to
2355another group, or do nothing (the default). If non-nil, this should
2356be a list of group name regexps that should match all groups in which
2357to do ham article moving, associated with the destination
2358group or nil for explicit ignoring. This only makes sense for
2359mail groups, and only works in spam groups."
2360 :variable-group spam
bf247b6e 2361 :variable-type
23f87bed
MB
2362 '(repeat
2363 :tag "Ham articles destination"
2364 (list
2365 (regexp :tag "Group Regexp")
2366 (choice
2367 :tag "Destination for ham articles at summary exit from spam group"
2368 (string :tag "Move to a group")
2369 (repeat :tag "Move to multiple groups"
2370 (string :tag "Destination group"))
2371 (const :tag "Respool" respool)
2372 (const :tag "Expire" nil))))
2373 :parameter-document
2374 "Where ham articles will go at summary exit from a spam group.")
2375
2376 (gnus-define-group-parameter
2377 ham-marks
2378 :type 'list
2379 :parameter-type '(list :tag "Ham mark choices"
2380 (set
2381 (variable-item gnus-del-mark)
2382 (variable-item gnus-read-mark)
2383 (variable-item gnus-ticked-mark)
2384 (variable-item gnus-killed-mark)
2385 (variable-item gnus-kill-file-mark)
2386 (variable-item gnus-low-score-mark)))
2387
2388 :parameter-document
2389 "Marks considered ham (positively not spam). Such articles will be
2390processed as ham (non-spam) on group exit. When nil, the global
2391spam-ham-marks variable takes precedence."
2392 :variable-default '((".*" ((gnus-del-mark
2393 gnus-read-mark
2394 gnus-killed-mark
2395 gnus-kill-file-mark
2396 gnus-low-score-mark))))
2397 :variable-group spam
2398 :variable-document
2399 "*Groups in which to explicitly set the ham marks to some value.")
2400
2401 (gnus-define-group-parameter
2402 spam-marks
2403 :type 'list
2404 :parameter-type '(list :tag "Spam mark choices"
2405 (set
2406 (variable-item gnus-spam-mark)
2407 (variable-item gnus-killed-mark)
2408 (variable-item gnus-kill-file-mark)
2409 (variable-item gnus-low-score-mark)))
2410
2411 :parameter-document
2412 "Marks considered spam.
2413Such articles will be processed as spam on group exit. When nil, the global
2414spam-spam-marks variable takes precedence."
2415 :variable-default '((".*" ((gnus-spam-mark))))
2416 :variable-group spam
2417 :variable-document
2418 "*Groups in which to explicitly set the spam marks to some value."))
eec82323
LMI
2419
2420(defcustom gnus-group-uncollapsed-levels 1
2421 "Number of group name elements to leave alone when making a short group name."
2422 :group 'gnus-group-visual
2423 :type 'integer)
2424
2425(defcustom gnus-group-use-permanent-levels nil
2426 "*If non-nil, once you set a level, Gnus will use this level."
2427 :group 'gnus-group-levels
2428 :type 'boolean)
2429
2430;; Hooks.
2431
2432(defcustom gnus-load-hook nil
2433 "A hook run while Gnus is loaded."
2434 :group 'gnus-start
2435 :type 'hook)
2436
2437(defcustom gnus-apply-kill-hook '(gnus-apply-kill-file)
2438 "A hook called to apply kill files to a group.
2439This hook is intended to apply a kill file to the selected newsgroup.
2440The function `gnus-apply-kill-file' is called by default.
2441
2442Since a general kill file is too heavy to use only for a few
2443newsgroups, I recommend you to use a lighter hook function. For
2444example, if you'd like to apply a kill file to articles which contains
2445a string `rmgroup' in subject in newsgroup `control', you can use the
2446following hook:
2447
2448 (setq gnus-apply-kill-hook
2449 (list
2450 (lambda ()
2451 (cond ((string-match \"control\" gnus-newsgroup-name)
2452 (gnus-kill \"Subject\" \"rmgroup\")
2453 (gnus-expunge \"X\"))))))"
2454 :group 'gnus-score-kill
2455 :options '(gnus-apply-kill-file)
2456 :type 'hook)
2457
2458(defcustom gnus-group-change-level-function nil
2459 "Function run when a group level is changed.
2460It is called with three parameters -- GROUP, LEVEL and OLDLEVEL."
16409b0b 2461 :group 'gnus-group-levels
4a2358e9
MB
2462 :type '(choice (const nil)
2463 function))
eec82323
LMI
2464
2465;;; Face thingies.
2466
2467(defcustom gnus-visual
2468 '(summary-highlight group-highlight article-highlight
2469 mouse-face
2470 summary-menu group-menu article-menu
2471 tree-highlight menu highlight
2472 browse-menu server-menu
01c52d31 2473 page-marker tree-menu binary-menu pick-menu)
6748645f 2474 "*Enable visual features.
eec82323
LMI
2475If `visual' is disabled, there will be no menus and few faces. Most of
2476the visual customization options below will be ignored. Gnus will use
2477less space and be faster as a result.
2478
2479This variable can also be a list of visual elements to switch on. For
2480instance, to switch off all visual things except menus, you can say:
2481
2482 (setq gnus-visual '(menu))
2483
2484Valid elements include `summary-highlight', `group-highlight',
2485`article-highlight', `mouse-face', `summary-menu', `group-menu',
2486`article-menu', `tree-highlight', `menu', `highlight', `browse-menu',
01c52d31 2487`server-menu', `page-marker', `tree-menu', `binary-menu', and`pick-menu'."
eec82323
LMI
2488 :group 'gnus-meta
2489 :group 'gnus-visual
2490 :type '(set (const summary-highlight)
2491 (const group-highlight)
2492 (const article-highlight)
2493 (const mouse-face)
2494 (const summary-menu)
2495 (const group-menu)
2496 (const article-menu)
2497 (const tree-highlight)
2498 (const menu)
2499 (const highlight)
2500 (const browse-menu)
2501 (const server-menu)
2502 (const page-marker)
2503 (const tree-menu)
2504 (const binary-menu)
01c52d31 2505 (const pick-menu)))
eec82323 2506
23f87bed
MB
2507;; Byte-compiler warning.
2508(defvar gnus-visual)
2509;; Find out whether the gnus-visual TYPE is wanted.
2510(defun gnus-visual-p (&optional type class)
2511 (and gnus-visual ; Has to be non-nil, at least.
2512 (if (not type) ; We don't care about type.
2513 gnus-visual
2514 (if (listp gnus-visual) ; It's a list, so we check it.
2515 (or (memq type gnus-visual)
2516 (memq class gnus-visual))
2517 t))))
2518
eec82323
LMI
2519(defcustom gnus-mouse-face
2520 (condition-case ()
2521 (if (gnus-visual-p 'mouse-face 'highlight)
2522 (if (boundp 'gnus-mouse-face)
2523 (or gnus-mouse-face 'highlight)
2524 'highlight)
2525 'default)
2526 (error 'highlight))
6748645f 2527 "*Face used for group or summary buffer mouse highlighting.
eec82323
LMI
2528The line beneath the mouse pointer will be highlighted with this
2529face."
2530 :group 'gnus-visual
2531 :type 'face)
2532
eec82323
LMI
2533(defcustom gnus-article-save-directory gnus-directory
2534 "*Name of the directory articles will be saved in (default \"~/News\")."
2535 :group 'gnus-article-saving
2536 :type 'directory)
2537
6748645f
LMI
2538(defvar gnus-plugged t
2539 "Whether Gnus is plugged or not.")
2540
23f87bed
MB
2541(defcustom gnus-agent-cache t
2542 "Controls use of the agent cache while plugged.
2543When set, Gnus will prefer using the locally stored content rather
2544than re-fetching it from the server. You also need to enable
2545`gnus-agent' for this to have any affect."
bf247b6e 2546 :version "22.1"
23f87bed
MB
2547 :group 'gnus-agent
2548 :type 'boolean)
2549
2550(defcustom gnus-default-charset 'undecided
16409b0b
GM
2551 "Default charset assumed to be used when viewing non-ASCII characters.
2552This variable is overridden on a group-to-group basis by the
23f87bed 2553`gnus-group-charset-alist' variable and is only used on groups not
16409b0b
GM
2554covered by that variable."
2555 :type 'symbol
2556 :group 'gnus-charset)
2557
23f87bed
MB
2558;; Fixme: Doc reference to agent.
2559(defcustom gnus-agent t
2560 "Whether we want to use the Gnus agent or not.
2561
2562You may customize gnus-agent to disable its use. However, some
2563back ends have started to use the agent as a client-side cache.
2564Disabling the agent may result in noticeable loss of performance."
bf247b6e 2565 :version "22.1"
23f87bed
MB
2566 :group 'gnus-agent
2567 :type 'boolean)
2568
2569(defcustom gnus-other-frame-function 'gnus
2570 "Function called by the command `gnus-other-frame'."
2571 :group 'gnus-start
2572 :type '(choice (function-item gnus)
2573 (function-item gnus-no-server)
2574 (function-item gnus-slave)
2575 (function-item gnus-slave-no-server)))
2576
2577(defcustom gnus-other-frame-parameters nil
2578 "Frame parameters used by `gnus-other-frame' to create a Gnus frame.
2579This should be an alist for Emacs, or a plist for XEmacs."
2580 :group 'gnus-start
2581 :type (if (featurep 'xemacs)
2582 '(repeat (list :inline t :format "%v"
2583 (symbol :tag "Property")
2584 (sexp :tag "Value")))
2585 '(repeat (cons :format "%v"
2586 (symbol :tag "Parameter")
2587 (sexp :tag "Value")))))
2588
4a2358e9 2589(defcustom gnus-user-agent '(emacs gnus type)
23f87bed
MB
2590 "Which information should be exposed in the User-Agent header.
2591
4a2358e9
MB
2592Can be a list of symbols or a string. Valid symbols are `gnus'
2593\(show Gnus version\) and `emacs' \(show Emacs version\). In
2594addition to the Emacs version, you can add `codename' \(show
2595\(S\)XEmacs codename\) or either `config' \(show system
2596configuration\) or `type' \(show system type\). If you set it to
2597a string, be sure to use a valid format, see RFC 2616."
2598
bf247b6e 2599 :version "22.1"
23f87bed 2600 :group 'gnus-message
4a2358e9
MB
2601 :type '(choice (list (set :inline t
2602 (const gnus :tag "Gnus version")
2603 (const emacs :tag "Emacs version")
2604 (choice :tag "system"
2605 (const type :tag "system type")
2606 (const config :tag "system configuration"))
2607 (const codename :tag "Emacs codename")))
2608 (string)))
2609
01c52d31 2610;; Convert old (< 2005-01-10) symbol type values:
4a2358e9
MB
2611(when (symbolp gnus-user-agent)
2612 (setq gnus-user-agent
2613 (cond ((eq gnus-user-agent 'emacs-gnus-config)
2614 '(emacs gnus config))
2615 ((eq gnus-user-agent 'emacs-gnus-type)
2616 '(emacs gnus type))
2617 ((eq gnus-user-agent 'emacs-gnus)
2618 '(emacs gnus))
2619 ((eq gnus-user-agent 'gnus)
2620 '(gnus))
2621 (t gnus-user-agent)))
2622 (gnus-message 1 "Converted `gnus-user-agent' to `%s'." gnus-user-agent)
2623 (sit-for 1)
2624 (if (get 'gnus-user-agent 'saved-value)
2625 (customize-save-variable 'gnus-user-agent gnus-user-agent)
2626 (gnus-message 1 "Edit your init file to make this change permanent.")
2627 (sit-for 2)))
16409b0b 2628
eec82323
LMI
2629\f
2630;;; Internal variables
2631
48df946a 2632(defvar gnus-agent-gcc-header "X-Gnus-Agent-Gcc")
16409b0b 2633(defvar gnus-agent-meta-information-header "X-Gnus-Agent-Meta-Information")
23f87bed
MB
2634(defvar gnus-agent-method-p-cache nil
2635 ; Reset each time gnus-agent-covered-methods is changed else
2636 ; gnus-agent-method-p may mis-report a methods status.
2637 )
2638(defvar gnus-agent-target-move-group-header "X-Gnus-Agent-Move-To")
2639(defvar gnus-draft-meta-information-header "X-Draft-From")
eec82323
LMI
2640(defvar gnus-group-get-parameter-function 'gnus-group-get-parameter)
2641(defvar gnus-original-article-buffer " *Original Article*")
2642(defvar gnus-newsgroup-name nil)
6748645f 2643(defvar gnus-ephemeral-servers nil)
23f87bed 2644(defvar gnus-server-method-cache nil)
6748645f 2645
48df946a
DL
2646(defvar gnus-agent-fetching nil
2647 "Whether Gnus agent is in fetching mode.")
2648
23f87bed
MB
2649(defvar gnus-agent-covered-methods nil
2650 "A list of servers, NOT methods, showing which servers are covered by the agent.")
2651
6748645f 2652(defvar gnus-command-method nil
23f87bed 2653 "Dynamically bound variable that says what the current back end is.")
eec82323
LMI
2654
2655(defvar gnus-current-select-method nil
2656 "The current method for selecting a newsgroup.")
2657
2658(defvar gnus-tree-buffer "*Tree*"
2659 "Buffer where Gnus thread trees are displayed.")
2660
2661;; Dummy variable.
2662(defvar gnus-use-generic-from nil)
2663
2664;; Variable holding the user answers to all method prompts.
2665(defvar gnus-method-history nil)
eec82323
LMI
2666
2667;; Variable holding the user answers to all mail method prompts.
2668(defvar gnus-mail-method-history nil)
2669
2670;; Variable holding the user answers to all group prompts.
2671(defvar gnus-group-history nil)
2672
2673(defvar gnus-server-alist nil
2674 "List of available servers.")
2675
6748645f
LMI
2676(defcustom gnus-cache-directory
2677 (nnheader-concat gnus-directory "cache/")
2678 "*The directory where cached articles will be stored."
2679 :group 'gnus-cache
2680 :type 'directory)
2681
eec82323
LMI
2682(defvar gnus-predefined-server-alist
2683 `(("cache"
6748645f
LMI
2684 nnspool "cache"
2685 (nnspool-spool-directory ,gnus-cache-directory)
2686 (nnspool-nov-directory ,gnus-cache-directory)
2687 (nnspool-active-file
2688 ,(nnheader-concat gnus-cache-directory "active"))))
eec82323
LMI
2689 "List of predefined (convenience) servers.")
2690
23f87bed 2691(defvar gnus-topic-indentation "") ;; Obsolete variable.
eec82323
LMI
2692
2693(defconst gnus-article-mark-lists
2694 '((marked . tick) (replied . reply)
2695 (expirable . expire) (killed . killed)
2696 (bookmarks . bookmark) (dormant . dormant)
2697 (scored . score) (saved . save)
6748645f 2698 (cached . cache) (downloadable . download)
23f87bed
MB
2699 (unsendable . unsend) (forwarded . forward)
2700 (recent . recent) (seen . seen)))
2701
2702(defconst gnus-article-special-mark-lists
2703 '((seen range)
2704 (killed range)
2705 (bookmark tuple)
2706 (score tuple)))
2707
2708;; Propagate flags to server, with the following exceptions:
2709;; `seen' is private to each gnus installation
2710;; `cache' is a internal gnus flag for each gnus installation
2711;; `download' is a agent flag private to each gnus installation
2712;; `unsend' are for nndraft groups only
2713;; `score' is not a proper mark
2714;; `bookmark': don't propagated it, or fix the bug in update-mark.
2715(defconst gnus-article-unpropagated-mark-lists
2716 '(seen cache download unsend score bookmark)
2717 "Marks that shouldn't be propagated to back ends.
2718Typical marks are those that make no sense in a standalone back end,
2719such as a mark that says whether an article is stored in the cache
2720\(which doesn't make sense in a standalone back end).")
eec82323
LMI
2721
2722(defvar gnus-headers-retrieved-by nil)
2723(defvar gnus-article-reply nil)
2724(defvar gnus-override-method nil)
eec82323
LMI
2725(defvar gnus-opened-servers nil)
2726
2727(defvar gnus-current-kill-article nil)
2728
2729(defvar gnus-have-read-active-file nil)
2730
2731(defconst gnus-maintainer
2732 "bugs@gnus.org (The Gnus Bugfixing Girls + Boys)"
2733 "The mail address of the Gnus maintainers.")
2734
2735(defvar gnus-info-nodes
23f87bed
MB
2736 '((gnus-group-mode "(gnus)Group Buffer")
2737 (gnus-summary-mode "(gnus)Summary Buffer")
2738 (gnus-article-mode "(gnus)Article Buffer")
2739 (gnus-server-mode "(gnus)Server Buffer")
eec82323
LMI
2740 (gnus-browse-mode "(gnus)Browse Foreign Server")
2741 (gnus-tree-mode "(gnus)Tree Display"))
2742 "Alist of major modes and related Info nodes.")
2743
2744(defvar gnus-group-buffer "*Group*")
2745(defvar gnus-summary-buffer "*Summary*")
2746(defvar gnus-article-buffer "*Article*")
2747(defvar gnus-server-buffer "*Server*")
2748
eec82323
LMI
2749(defvar gnus-slave nil
2750 "Whether this Gnus is a slave or not.")
2751
2752(defvar gnus-batch-mode nil
2753 "Whether this Gnus is running in batch mode or not.")
2754
2755(defvar gnus-variable-list
2756 '(gnus-newsrc-options gnus-newsrc-options-n
16409b0b
GM
2757 gnus-newsrc-last-checked-date
2758 gnus-newsrc-alist gnus-server-alist
2759 gnus-killed-list gnus-zombie-list
2760 gnus-topic-topology gnus-topic-alist
2761 gnus-format-specs)
eec82323
LMI
2762 "Gnus variables saved in the quick startup file.")
2763
2764(defvar gnus-newsrc-alist nil
2765 "Assoc list of read articles.
23f87bed
MB
2766`gnus-newsrc-hashtb' should be kept so that both hold the same information.")
2767
2768(defvar gnus-registry-alist nil
2769 "Assoc list of registry data.
2770gnus-registry.el will populate this if it's loaded.")
eec82323
LMI
2771
2772(defvar gnus-newsrc-hashtb nil
23f87bed 2773 "Hashtable of `gnus-newsrc-alist'.")
eec82323
LMI
2774
2775(defvar gnus-killed-list nil
2776 "List of killed newsgroups.")
2777
2778(defvar gnus-killed-hashtb nil
23f87bed 2779 "Hash table equivalent of `gnus-killed-list'.")
eec82323
LMI
2780
2781(defvar gnus-zombie-list nil
2782 "List of almost dead newsgroups.")
2783
2784(defvar gnus-description-hashtb nil
2785 "Descriptions of newsgroups.")
2786
2787(defvar gnus-list-of-killed-groups nil
2788 "List of newsgroups that have recently been killed by the user.")
2789
2790(defvar gnus-active-hashtb nil
2791 "Hashtable of active articles.")
2792
2793(defvar gnus-moderated-hashtb nil
2794 "Hashtable of moderated newsgroups.")
2795
2796;; Save window configuration.
2797(defvar gnus-prev-winconf nil)
2798
2799(defvar gnus-reffed-article-number nil)
2800
2801;;; Let the byte-compiler know that we know about this variable.
2802(defvar rmail-default-rmail-file)
2803
2804(defvar gnus-dead-summary nil)
2805
16409b0b
GM
2806(defvar gnus-invalid-group-regexp "[: `'\"/]\\|^$"
2807 "Regexp matching invalid groups.")
2808
23f87bed
MB
2809(defvar gnus-other-frame-object nil
2810 "A frame object which will be created by `gnus-other-frame'.")
2811
eec82323
LMI
2812;;; End of variables.
2813
2814;; Define some autoload functions Gnus might use.
2815(eval-and-compile
2816
2817 ;; This little mapcar goes through the list below and marks the
2818 ;; symbols in question as autoloaded functions.
01c52d31 2819 (mapc
eec82323
LMI
2820 (lambda (package)
2821 (let ((interactive (nth 1 (memq ':interactive package))))
2822 (mapcar
2823 (lambda (function)
2824 (let (keymap)
2825 (when (consp function)
2826 (setq keymap (car (memq 'keymap function)))
2827 (setq function (car function)))
16409b0b
GM
2828 (unless (fboundp function)
2829 (autoload function (car package) nil interactive keymap))))
eec82323 2830 (if (eq (nth 1 package) ':interactive)
16409b0b 2831 (nthcdr 3 package)
eec82323 2832 (cdr package)))))
16409b0b 2833 '(("info" :interactive t Info-goto-node)
ceaed79b 2834 ("pp" pp-to-string)
16409b0b 2835 ("qp" quoted-printable-decode-region quoted-printable-decode-string)
eec82323 2836 ("ps-print" ps-print-preprint)
eec82323
LMI
2837 ("message" :interactive t
2838 message-send-and-exit message-yank-original)
16409b0b
GM
2839 ("babel" babel-as-string)
2840 ("nnmail" nnmail-split-fancy nnmail-article-group)
eec82323 2841 ("nnvirtual" nnvirtual-catchup-group nnvirtual-convert-headers)
16409b0b 2842 ("rmailout" rmail-output rmail-output-to-rmail-file)
eec82323 2843 ("rmail" rmail-insert-rmail-file-header rmail-count-new-messages
6748645f
LMI
2844 rmail-show-message rmail-summary-exists
2845 rmail-select-summary rmail-update-summary)
eec82323
LMI
2846 ("gnus-audio" :interactive t gnus-audio-play)
2847 ("gnus-xmas" gnus-xmas-splash)
2848 ("gnus-soup" :interactive t
2849 gnus-group-brew-soup gnus-brew-soup gnus-soup-add-article
2850 gnus-soup-send-replies gnus-soup-save-areas gnus-soup-pack-packet)
2851 ("nnsoup" nnsoup-pack-replies)
2852 ("score-mode" :interactive t gnus-score-mode)
2853 ("gnus-mh" gnus-summary-save-article-folder
2854 gnus-Folder-save-name gnus-folder-save-name)
2855 ("gnus-mh" :interactive t gnus-summary-save-in-folder)
2856 ("gnus-demon" gnus-demon-add-nocem gnus-demon-add-scanmail
2857 gnus-demon-add-rescan gnus-demon-add-scan-timestamps
2858 gnus-demon-add-disconnection gnus-demon-add-handler
2859 gnus-demon-remove-handler)
2860 ("gnus-demon" :interactive t
2861 gnus-demon-init gnus-demon-cancel)
23f87bed
MB
2862 ("gnus-fun" gnus-convert-gray-x-face-to-xpm gnus-display-x-face-in-from
2863 gnus-convert-image-to-gray-x-face gnus-convert-face-to-png
2864 gnus-face-from-file)
eec82323
LMI
2865 ("gnus-salt" gnus-highlight-selected-tree gnus-possibly-generate-tree
2866 gnus-tree-open gnus-tree-close gnus-carpal-setup-buffer)
2867 ("gnus-nocem" gnus-nocem-scan-groups gnus-nocem-close
2868 gnus-nocem-unwanted-article-p)
6748645f
LMI
2869 ("gnus-srvr" gnus-enter-server-buffer gnus-server-set-info
2870 gnus-server-server-name)
eec82323
LMI
2871 ("gnus-srvr" gnus-browse-foreign-server)
2872 ("gnus-cite" :interactive t
2873 gnus-article-highlight-citation gnus-article-hide-citation-maybe
2874 gnus-article-hide-citation gnus-article-fill-cited-article
2875 gnus-article-hide-citation-in-followups)
2876 ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
2877 gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
16409b0b 2878 gnus-execute gnus-expunge gnus-batch-kill gnus-batch-score)
eec82323
LMI
2879 ("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
2880 gnus-cache-possibly-remove-articles gnus-cache-request-article
2881 gnus-cache-retrieve-headers gnus-cache-possibly-alter-active
2882 gnus-cache-enter-remove-article gnus-cached-article-p
16409b0b
GM
2883 gnus-cache-open gnus-cache-close gnus-cache-update-article
2884 gnus-cache-articles-in-group)
2885 ("gnus-cache" :interactive t gnus-jog-cache gnus-cache-enter-article
2886 gnus-cache-remove-article gnus-summary-insert-cached-articles)
2887 ("gnus-score" :interactive t
2888 gnus-summary-increase-score gnus-summary-set-score
2889 gnus-summary-raise-thread gnus-summary-raise-same-subject
2890 gnus-summary-raise-score gnus-summary-raise-same-subject-and-select
2891 gnus-summary-lower-thread gnus-summary-lower-same-subject
2892 gnus-summary-lower-score gnus-summary-lower-same-subject-and-select
2893 gnus-summary-current-score gnus-score-delta-default
2894 gnus-score-flush-cache gnus-score-close
2895 gnus-possibly-score-headers gnus-score-followup-article
2896 gnus-score-followup-thread)
2897 ("gnus-score"
2898 (gnus-summary-score-map keymap) gnus-score-save gnus-score-headers
eec82323
LMI
2899 gnus-current-score-file-nondirectory gnus-score-adaptive
2900 gnus-score-find-trace gnus-score-file-name)
2901 ("gnus-cus" :interactive t gnus-group-customize gnus-score-customize)
2902 ("gnus-topic" :interactive t gnus-topic-mode)
16409b0b
GM
2903 ("gnus-topic" gnus-topic-remove-group gnus-topic-set-parameters
2904 gnus-subscribe-topics)
eec82323
LMI
2905 ("gnus-salt" :interactive t gnus-pick-mode gnus-binary-mode)
2906 ("gnus-uu" (gnus-uu-extract-map keymap) (gnus-uu-mark-map keymap))
2907 ("gnus-uu" :interactive t
2908 gnus-uu-digest-mail-forward gnus-uu-digest-post-forward
2909 gnus-uu-mark-series gnus-uu-mark-region gnus-uu-mark-buffer
2910 gnus-uu-mark-by-regexp gnus-uu-mark-all
2911 gnus-uu-mark-sparse gnus-uu-mark-thread gnus-uu-decode-uu
2912 gnus-uu-decode-uu-and-save gnus-uu-decode-unshar
2913 gnus-uu-decode-unshar-and-save gnus-uu-decode-save
2914 gnus-uu-decode-binhex gnus-uu-decode-uu-view
2915 gnus-uu-decode-uu-and-save-view gnus-uu-decode-unshar-view
2916 gnus-uu-decode-unshar-and-save-view gnus-uu-decode-save-view
6748645f 2917 gnus-uu-decode-binhex-view gnus-uu-unmark-thread
01c52d31 2918 gnus-uu-mark-over gnus-uu-post-news gnus-uu-invert-processable)
16409b0b 2919 ("gnus-uu" gnus-uu-delete-work-dir gnus-uu-unmark-thread)
eec82323
LMI
2920 ("gnus-msg" (gnus-summary-send-map keymap)
2921 gnus-article-mail gnus-copy-article-buffer gnus-extended-version)
2922 ("gnus-msg" :interactive t
23f87bed
MB
2923 gnus-group-post-news gnus-group-mail gnus-group-news
2924 gnus-summary-post-news gnus-summary-news-other-window
eec82323
LMI
2925 gnus-summary-followup gnus-summary-followup-with-original
2926 gnus-summary-cancel-article gnus-summary-supersede-article
2927 gnus-post-news gnus-summary-reply gnus-summary-reply-with-original
2928 gnus-summary-mail-forward gnus-summary-mail-other-window
2929 gnus-summary-resend-message gnus-summary-resend-bounced-mail
6748645f
LMI
2930 gnus-summary-wide-reply gnus-summary-followup-to-mail
2931 gnus-summary-followup-to-mail-with-original gnus-bug
2932 gnus-summary-wide-reply-with-original
2933 gnus-summary-post-forward gnus-summary-wide-reply-with-original
2934 gnus-summary-post-forward)
23f87bed 2935 ("gnus-picon" :interactive t gnus-treat-from-picon)
23f87bed 2936 ("smiley" :interactive t smiley-region)
eec82323
LMI
2937 ("gnus-win" gnus-configure-windows gnus-add-configuration)
2938 ("gnus-sum" gnus-summary-insert-line gnus-summary-read-group
2939 gnus-list-of-unread-articles gnus-list-of-read-articles
2940 gnus-offer-save-summaries gnus-make-thread-indent-array
6748645f
LMI
2941 gnus-summary-exit gnus-update-read-articles gnus-summary-last-subject
2942 gnus-summary-skip-intangible gnus-summary-article-number
2943 gnus-data-header gnus-data-find)
eec82323
LMI
2944 ("gnus-group" gnus-group-insert-group-line gnus-group-quit
2945 gnus-group-list-groups gnus-group-first-unread-group
2946 gnus-group-set-mode-line gnus-group-set-info gnus-group-save-newsrc
2947 gnus-group-setup-buffer gnus-group-get-new-news
6748645f 2948 gnus-group-make-help-group gnus-group-update-group
16409b0b 2949 gnus-group-iterate gnus-group-group-name)
eec82323
LMI
2950 ("gnus-bcklg" gnus-backlog-request-article gnus-backlog-enter-article
2951 gnus-backlog-remove-article)
2952 ("gnus-art" gnus-article-read-summary-keys gnus-article-save
2953 gnus-article-prepare gnus-article-set-window-start
2954 gnus-article-next-page gnus-article-prev-page
2955 gnus-request-article-this-buffer gnus-article-mode
2956 gnus-article-setup-buffer gnus-narrow-to-page
16409b0b 2957 gnus-article-delete-invisible-text gnus-treat-article)
eec82323
LMI
2958 ("gnus-art" :interactive t
2959 gnus-article-hide-headers gnus-article-hide-boring-headers
16409b0b 2960 gnus-article-treat-overstrike
eec82323
LMI
2961 gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
2962 gnus-article-display-x-face gnus-article-de-quoted-unreadable
16409b0b
GM
2963 gnus-article-de-base64-unreadable
2964 gnus-article-decode-HZ
2965 gnus-article-wash-html
23f87bed 2966 gnus-article-unsplit-urls
eec82323
LMI
2967 gnus-article-hide-pem gnus-article-hide-signature
2968 gnus-article-strip-leading-blank-lines gnus-article-date-local
2969 gnus-article-date-original gnus-article-date-lapsed
01c52d31 2970 ;;gnus-article-show-all-headers
eec82323 2971 gnus-article-edit-mode gnus-article-edit-article
16409b0b
GM
2972 gnus-article-edit-done gnus-article-decode-encoded-words
2973 gnus-start-date-timer gnus-stop-date-timer
2974 gnus-mime-view-all-parts)
eec82323
LMI
2975 ("gnus-int" gnus-request-type)
2976 ("gnus-start" gnus-newsrc-parse-options gnus-1 gnus-no-server-1
01c52d31
MB
2977 gnus-dribble-enter gnus-read-init-file gnus-dribble-touch
2978 gnus-check-reasonable-setup)
eec82323
LMI
2979 ("gnus-dup" gnus-dup-suppress-articles gnus-dup-unsuppress-article
2980 gnus-dup-enter-articles)
2981 ("gnus-range" gnus-copy-sequence)
2982 ("gnus-eform" gnus-edit-form)
2983 ("gnus-move" :interactive t
2984 gnus-group-move-group-to-server gnus-change-server)
2985 ("gnus-logic" gnus-score-advanced)
2986 ("gnus-undo" gnus-undo-mode gnus-undo-register)
2987 ("gnus-async" gnus-async-request-fetched-article gnus-async-prefetch-next
2988 gnus-async-prefetch-article gnus-async-prefetch-remove-group
2989 gnus-async-halt-prefetch)
6748645f 2990 ("gnus-agent" gnus-open-agent gnus-agent-get-function
fa9a04e1 2991 gnus-agent-save-active gnus-agent-method-p
6748645f 2992 gnus-agent-get-undownloaded-list gnus-agent-fetch-session
23f87bed
MB
2993 gnus-summary-set-agent-mark gnus-agent-save-group-info
2994 gnus-agent-request-article gnus-agent-retrieve-headers)
6748645f
LMI
2995 ("gnus-agent" :interactive t
2996 gnus-unplugged gnus-agentize gnus-agent-batch)
eec82323 2997 ("gnus-vm" :interactive t gnus-summary-save-in-vm
6748645f 2998 gnus-summary-save-article-vm)
23f87bed
MB
2999 ("compface" uncompface)
3000 ("gnus-draft" :interactive t gnus-draft-mode gnus-group-send-queue)
16409b0b
GM
3001 ("gnus-mlspl" gnus-group-split gnus-group-split-fancy)
3002 ("gnus-mlspl" :interactive t gnus-group-split-setup
23f87bed
MB
3003 gnus-group-split-update)
3004 ("gnus-delay" gnus-delay-initialize))))
eec82323
LMI
3005
3006;;; gnus-sum.el thingies
3007
3008
23f87bed 3009(defcustom gnus-summary-line-format "%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n"
eec82323
LMI
3010 "*The format specification of the lines in the summary buffer.
3011
3012It works along the same lines as a normal formatting string,
3013with some simple extensions.
3014
3015%N Article number, left padded with spaces (string)
3016%S Subject (string)
3017%s Subject if it is at the root of a thread, and \"\" otherwise (string)
3018%n Name of the poster (string)
3019%a Extracted name of the poster (string)
3020%A Extracted address of the poster (string)
3021%F Contents of the From: header (string)
16409b0b 3022%f Contents of the From: or To: headers (string)
eec82323
LMI
3023%x Contents of the Xref: header (string)
3024%D Date of the article (string)
3025%d Date of the article (string) in DD-MMM format
23f87bed 3026%o Date of the article (string) in YYYYMMDD`T'HHMMSS format
eec82323
LMI
3027%M Message-id of the article (string)
3028%r References of the article (string)
3029%c Number of characters in the article (integer)
23f87bed
MB
3030%k Pretty-printed version of the above (string)
3031 For example, \"1.2k\" or \"0.4M\".
eec82323
LMI
3032%L Number of lines in the article (integer)
3033%I Indentation based on thread level (a string of spaces)
23f87bed
MB
3034%B A complex trn-style thread tree (string)
3035 The variables `gnus-sum-thread-*' can be used for customization.
eec82323
LMI
3036%T A string with two possible values: 80 spaces if the article
3037 is on thread level two or larger and 0 spaces on level one
3038%R \"A\" if this article has been replied to, \" \" otherwise (character)
3039%U Status of this article (character, \"R\", \"K\", \"-\" or \" \")
3040%[ Opening bracket (character, \"[\" or \"<\")
3041%] Closing bracket (character, \"]\" or \">\")
3042%> Spaces of length thread-level (string)
3043%< Spaces of length (- 20 thread-level) (string)
3044%i Article score (number)
3045%z Article zcore (character)
3046%t Number of articles under the current thread (number).
3047%e Whether the thread is empty or not (character).
eec82323
LMI
3048%V Total thread score (number).
3049%P The line number (number).
6748645f 3050%O Download mark (character).
23f87bed
MB
3051%* If present, indicates desired cursor position
3052 (instead of after first colon).
eec82323
LMI
3053%u User defined specifier. The next character in the format string should
3054 be a letter. Gnus will call the function gnus-user-format-function-X,
3055 where X is the letter following %u. The function will be passed the
3056 current header as argument. The function should return a string, which
3057 will be inserted into the summary just like information from any other
3058 summary specifier.
3059
eec82323
LMI
3060The %U (status), %R (replied) and %z (zcore) specs have to be handled
3061with care. For reasons of efficiency, Gnus will compute what column
3062these characters will end up in, and \"hard-code\" that. This means that
65a32076 3063it is invalid to have these specs after a variable-length spec. Well,
eec82323
LMI
3064you might not be arrested, but your summary buffer will look strange,
3065which is bad enough.
3066
23f87bed 3067The smart choice is to have these specs as far to the left as
eec82323
LMI
3068possible.
3069
23f87bed
MB
3070This restriction may disappear in later versions of Gnus.
3071
3072General format specifiers can also be used.
3073See Info node `(gnus)Formatting Variables'."
3074 :link '(custom-manual "(gnus)Formatting Variables")
eec82323
LMI
3075 :type 'string
3076 :group 'gnus-summary-format)
3077
3078;;;
3079;;; Skeleton keymaps
3080;;;
3081
3082(defun gnus-suppress-keymap (keymap)
3083 (suppress-keymap keymap)
6748645f 3084 (let ((keys `([backspace] [delete] "\177" "\M-u"))) ;gnus-mouse-2
eec82323
LMI
3085 (while keys
3086 (define-key keymap (pop keys) 'undefined))))
3087
3088(defvar gnus-article-mode-map
16409b0b 3089 (let ((keymap (make-sparse-keymap)))
eec82323
LMI
3090 (gnus-suppress-keymap keymap)
3091 keymap))
3092(defvar gnus-summary-mode-map
3093 (let ((keymap (make-keymap)))
3094 (gnus-suppress-keymap keymap)
3095 keymap))
3096(defvar gnus-group-mode-map
3097 (let ((keymap (make-keymap)))
3098 (gnus-suppress-keymap keymap)
3099 keymap))
3100
3101\f
3102
3103;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3104;; If you want the cursor to go somewhere else, set these two
3105;; functions in some startup hook to whatever you want.
3106(defalias 'gnus-summary-position-point 'gnus-goto-colon)
3107(defalias 'gnus-group-position-point 'gnus-goto-colon)
3108
3109;;; Various macros and substs.
3110
3111(defun gnus-header-from (header)
3112 (mail-header-from header))
3113
3114(defmacro gnus-gethash (string hashtable)
3115 "Get hash value of STRING in HASHTABLE."
3116 `(symbol-value (intern-soft ,string ,hashtable)))
3117
23f87bed
MB
3118(defmacro gnus-gethash-safe (string hashtable)
3119 "Get hash value of STRING in HASHTABLE.
3120Return nil if not defined."
3121 `(let ((sym (intern-soft ,string ,hashtable)))
3122 (and (boundp sym) (symbol-value sym))))
3123
eec82323
LMI
3124(defmacro gnus-sethash (string value hashtable)
3125 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
3126 `(set (intern ,string ,hashtable) ,value))
3127(put 'gnus-sethash 'edebug-form-spec '(form form form))
3128
3129(defmacro gnus-group-unread (group)
3130 "Get the currently computed number of unread articles in GROUP."
3131 `(car (gnus-gethash ,group gnus-newsrc-hashtb)))
3132
3133(defmacro gnus-group-entry (group)
3134 "Get the newsrc entry for GROUP."
3135 `(gnus-gethash ,group gnus-newsrc-hashtb))
3136
3137(defmacro gnus-active (group)
3138 "Get active info on GROUP."
3139 `(gnus-gethash ,group gnus-active-hashtb))
3140
3141(defmacro gnus-set-active (group active)
3142 "Set GROUP's active info."
3143 `(gnus-sethash ,group ,active gnus-active-hashtb))
3144
eec82323
LMI
3145;; Info access macros.
3146
3147(defmacro gnus-info-group (info)
3148 `(nth 0 ,info))
3149(defmacro gnus-info-rank (info)
3150 `(nth 1 ,info))
3151(defmacro gnus-info-read (info)
3152 `(nth 2 ,info))
3153(defmacro gnus-info-marks (info)
3154 `(nth 3 ,info))
3155(defmacro gnus-info-method (info)
3156 `(nth 4 ,info))
3157(defmacro gnus-info-params (info)
3158 `(nth 5 ,info))
3159
3160(defmacro gnus-info-level (info)
3161 `(let ((rank (gnus-info-rank ,info)))
3162 (if (consp rank)
3163 (car rank)
3164 rank)))
3165(defmacro gnus-info-score (info)
3166 `(let ((rank (gnus-info-rank ,info)))
3167 (or (and (consp rank) (cdr rank)) 0)))
3168
3169(defmacro gnus-info-set-group (info group)
3170 `(setcar ,info ,group))
3171(defmacro gnus-info-set-rank (info rank)
3172 `(setcar (nthcdr 1 ,info) ,rank))
3173(defmacro gnus-info-set-read (info read)
3174 `(setcar (nthcdr 2 ,info) ,read))
3175(defmacro gnus-info-set-marks (info marks &optional extend)
3176 (if extend
3177 `(gnus-info-set-entry ,info ,marks 3)
3178 `(setcar (nthcdr 3 ,info) ,marks)))
3179(defmacro gnus-info-set-method (info method &optional extend)
3180 (if extend
3181 `(gnus-info-set-entry ,info ,method 4)
3182 `(setcar (nthcdr 4 ,info) ,method)))
3183(defmacro gnus-info-set-params (info params &optional extend)
3184 (if extend
3185 `(gnus-info-set-entry ,info ,params 5)
3186 `(setcar (nthcdr 5 ,info) ,params)))
3187
3188(defun gnus-info-set-entry (info entry number)
3189 ;; Extend the info until we have enough elements.
3190 (while (<= (length info) number)
3191 (nconc info (list nil)))
3192 ;; Set the entry.
3193 (setcar (nthcdr number info) entry))
3194
3195(defmacro gnus-info-set-level (info level)
3196 `(let ((rank (cdr ,info)))
3197 (if (consp (car rank))
3198 (setcar (car rank) ,level)
3199 (setcar rank ,level))))
3200(defmacro gnus-info-set-score (info score)
3201 `(let ((rank (cdr ,info)))
3202 (if (consp (car rank))
3203 (setcdr (car rank) ,score)
3204 (setcar rank (cons (car rank) ,score)))))
3205
3206(defmacro gnus-get-info (group)
3207 `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
3208
8f688cb0 3209;;; Load the compatibility functions.
eec82323
LMI
3210
3211(require 'gnus-ems)
3212
3213\f
3214;;;
3215;;; Shutdown
3216;;;
3217
3218(defvar gnus-shutdown-alist nil)
3219
3220(defun gnus-add-shutdown (function &rest symbols)
3221 "Run FUNCTION whenever one of SYMBOLS is shut down."
3222 (push (cons function symbols) gnus-shutdown-alist))
3223
3224(defun gnus-shutdown (symbol)
3225 "Shut down everything that waits for SYMBOL."
01c52d31
MB
3226 (dolist (entry gnus-shutdown-alist)
3227 (when (memq symbol (cdr entry))
3228 (funcall (car entry)))))
eec82323
LMI
3229
3230\f
3231;;;
3232;;; Gnus Utility Functions
3233;;;
3234
23f87bed
MB
3235(defun gnus-find-subscribed-addresses ()
3236 "Return a regexp matching the addresses of all subscribed mail groups.
3237It consists of the `to-address' or `to-list' parameter of all groups
3238with a `subscribed' parameter."
3239 (let (group address addresses)
3240 (dolist (entry (cdr gnus-newsrc-alist))
3241 (setq group (car entry))
3242 (when (gnus-parameter-subscribed group)
3243 (setq address (mail-strip-quoted-names
3244 (or (gnus-group-fast-parameter group 'to-address)
3245 (gnus-group-fast-parameter group 'to-list))))
3246 (when address
3247 (add-to-list 'addresses address))))
3248 (when addresses
3249 (list (mapconcat 'regexp-quote addresses "\\|")))))
6748645f 3250
a8151ef7
LMI
3251(defmacro gnus-string-or (&rest strings)
3252 "Return the first element of STRINGS that is a non-blank string.
3253STRINGS will be evaluated in normal `or' order."
3254 `(gnus-string-or-1 ',strings))
3255
3256(defun gnus-string-or-1 (strings)
3257 (let (string)
3258 (while strings
3259 (setq string (eval (pop strings)))
3260 (if (string-match "^[ \t]*$" string)
3261 (setq string nil)
3262 (setq strings nil)))
3263 string))
3264
eec82323
LMI
3265(defun gnus-version (&optional arg)
3266 "Version number of this version of Gnus.
3267If ARG, insert string at point."
3268 (interactive "P")
6748645f
LMI
3269 (if arg
3270 (insert (message gnus-version))
3271 (message gnus-version)))
eec82323 3272
23f87bed 3273(defun gnus-continuum-version (&optional version)
eec82323 3274 "Return VERSION as a floating point number."
23f87bed
MB
3275 (interactive)
3276 (unless version
3277 (setq version gnus-version))
eec82323
LMI
3278 (when (or (string-match "^\\([^ ]+\\)? ?Gnus v?\\([0-9.]+\\)$" version)
3279 (string-match "^\\(.?\\)gnus-\\([0-9.]+\\)$" version))
6748645f
LMI
3280 (let ((alpha (and (match-beginning 1) (match-string 1 version)))
3281 (number (match-string 2 version))
3282 major minor least)
3283 (unless (string-match
3284 "\\([0-9]\\)\\.\\([0-9]+\\)\\.?\\([0-9]+\\)?" number)
3285 (error "Invalid version string: %s" version))
3286 (setq major (string-to-number (match-string 1 number))
3287 minor (string-to-number (match-string 2 number))
3288 least (if (match-beginning 3)
eec82323
LMI
3289 (string-to-number (match-string 3 number))
3290 0))
3291 (string-to-number
3292 (if (zerop major)
23f87bed
MB
3293 (format "%s00%02d%02d"
3294 (if (member alpha '("(ding)" "d"))
3295 "4.99"
3296 (+ 5 (* 0.02
3297 (abs
3298 (- (mm-char-int (aref (downcase alpha) 0))
3299 (mm-char-int ?t))))
3300 -0.01))
3301 minor least)
eec82323
LMI
3302 (format "%d.%02d%02d" major minor least))))))
3303
23f87bed 3304(defun gnus-info-find-node (&optional nodename)
eec82323
LMI
3305 "Find Info documentation of Gnus."
3306 (interactive)
3307 ;; Enlarge info window if needed.
3308 (let (gnus-info-buffer)
23f87bed 3309 (Info-goto-node (or nodename (cadr (assq major-mode gnus-info-nodes))))
eec82323
LMI
3310 (setq gnus-info-buffer (current-buffer))
3311 (gnus-configure-windows 'info)))
3312
6748645f
LMI
3313;;;
3314;;; gnus-interactive
3315;;;
3316
3317(defvar gnus-current-prefix-symbol nil
3318 "Current prefix symbol.")
3319
3320(defvar gnus-current-prefix-symbols nil
3321 "List of current prefix symbols.")
3322
3323(defun gnus-interactive (string &optional params)
3324 "Return a list that can be fed to `interactive'.
3325See `interactive' for full documentation.
3326
3327Adds the following specs:
3328
3329y -- The current symbolic prefix.
3330Y -- A list of the current symbolic prefix(es).
3331A -- Article number.
3332H -- Article header.
3333g -- Group name."
3334 (let ((i 0)
3335 out c prompt)
3336 (while (< i (length string))
3337 (string-match ".\\([^\n]*\\)\n?" string i)
3338 (setq c (aref string i))
3339 (when (match-end 1)
3340 (setq prompt (match-string 1 string)))
3341 (setq i (match-end 0))
3342 ;; We basically emulate just about everything that
3343 ;; `interactive' does, but add the specs listed above.
3344 (push
3345 (cond
3346 ((= c ?a)
3347 (completing-read prompt obarray 'fboundp t))
3348 ((= c ?b)
3349 (read-buffer prompt (current-buffer) t))
3350 ((= c ?B)
3351 (read-buffer prompt (other-buffer (current-buffer))))
3352 ((= c ?c)
3353 (read-char))
3354 ((= c ?C)
3355 (completing-read prompt obarray 'commandp t))
3356 ((= c ?d)
3357 (point))
3358 ((= c ?D)
3359 (read-file-name prompt nil default-directory 'lambda))
3360 ((= c ?f)
3361 (read-file-name prompt nil nil 'lambda))
3362 ((= c ?F)
3363 (read-file-name prompt))
3364 ((= c ?k)
3365 (read-key-sequence prompt))
3366 ((= c ?K)
3367 (error "Not implemented spec"))
3368 ((= c ?e)
3369 (error "Not implemented spec"))
3370 ((= c ?m)
3371 (mark))
3372 ((= c ?N)
3373 (error "Not implemented spec"))
3374 ((= c ?n)
3375 (string-to-number (read-from-minibuffer prompt)))
3376 ((= c ?p)
3377 (prefix-numeric-value current-prefix-arg))
3378 ((= c ?P)
3379 current-prefix-arg)
3380 ((= c ?r)
3381 'gnus-prefix-nil)
3382 ((= c ?s)
3383 (read-string prompt))
3384 ((= c ?S)
3385 (intern (read-string prompt)))
3386 ((= c ?v)
3387 (read-variable prompt))
3388 ((= c ?x)
3389 (read-minibuffer prompt))
3390 ((= c ?x)
3391 (eval-minibuffer prompt))
3392 ;; And here the new specs come.
3393 ((= c ?y)
3394 gnus-current-prefix-symbol)
3395 ((= c ?Y)
3396 gnus-current-prefix-symbols)
3397 ((= c ?g)
3398 (gnus-group-group-name))
3399 ((= c ?A)
3400 (gnus-summary-skip-intangible)
3401 (or (get-text-property (point) 'gnus-number)
3402 (gnus-summary-last-subject)))
3403 ((= c ?H)
3404 (gnus-data-header (gnus-data-find (gnus-summary-article-number))))
3405 (t
3406 (error "Non-implemented spec")))
3407 out)
3408 (cond
3409 ((= c ?r)
fa066d09
GM
3410 (push (if (< (point) (mark)) (point) (mark)) out)
3411 (push (if (> (point) (mark)) (point) (mark)) out))))
6748645f
LMI
3412 (setq out (delq 'gnus-prefix-nil out))
3413 (nreverse out)))
3414
3415(defun gnus-symbolic-argument (&optional arg)
3416 "Read a symbolic argument and a command, and then execute command."
3417 (interactive "P")
3418 (let* ((in-command (this-command-keys))
3419 (command in-command)
3420 gnus-current-prefix-symbols
3421 gnus-current-prefix-symbol
3422 syms)
3423 (while (equal in-command command)
3424 (message "%s-" (key-description (this-command-keys)))
3425 (push (intern (char-to-string (read-char))) syms)
3426 (setq command (read-key-sequence nil t)))
3427 (setq gnus-current-prefix-symbols (nreverse syms)
3428 gnus-current-prefix-symbol (car gnus-current-prefix-symbols))
3429 (call-interactively (key-binding command t))))
3430
eec82323
LMI
3431;;; More various functions.
3432
a36c8d02
RS
3433(defsubst gnus-check-backend-function (func group)
3434 "Check whether GROUP supports function FUNC.
3435GROUP can either be a string (a group name) or a select method."
3436 (ignore-errors
3437 (let ((method (if (stringp group)
3438 (car (gnus-find-method-for-group group))
3439 group)))
3440 (unless (featurep method)
3441 (require method))
3442 (fboundp (intern (format "%s-%s" method func))))))
3443
eec82323
LMI
3444(defun gnus-group-read-only-p (&optional group)
3445 "Check whether GROUP supports editing or not.
65a32076 3446If GROUP is nil, `gnus-newsgroup-name' will be checked instead. Note
eec82323
LMI
3447that that variable is buffer-local to the summary buffers."
3448 (let ((group (or group gnus-newsgroup-name)))
3449 (not (gnus-check-backend-function 'request-replace-article group))))
3450
eec82323
LMI
3451(defun gnus-virtual-group-p (group)
3452 "Say whether GROUP is virtual or not."
3453 (memq 'virtual (assoc (symbol-name (car (gnus-find-method-for-group group)))
3454 gnus-valid-select-methods)))
3455
3456(defun gnus-news-group-p (group &optional article)
3457 "Return non-nil if GROUP (and ARTICLE) come from a news server."
23f87bed
MB
3458 (cond ((gnus-member-of-valid 'post group) ;Ordinary news group
3459 t) ;is news of course.
3460 ((not (gnus-member-of-valid 'post-mail group)) ;Non-combined.
3461 nil) ;must be mail then.
3462 ((vectorp article) ;Has header info.
3463 (eq (gnus-request-type group (mail-header-id article)) 'news))
3464 ((null article) ;Hasn't header info
3465 (eq (gnus-request-type group) 'news)) ;(unknown ==> mail)
3466 ((< article 0) ;Virtual message
3467 nil) ;we don't know, guess mail.
3468 (t ;Has positive number
3469 (eq (gnus-request-type group article) 'news)))) ;use it.
eec82323
LMI
3470
3471;; Returns a list of writable groups.
3472(defun gnus-writable-groups ()
3473 (let ((alist gnus-newsrc-alist)
3474 groups group)
3475 (while (setq group (car (pop alist)))
3476 (unless (gnus-group-read-only-p group)
3477 (push group groups)))
3478 (nreverse groups)))
3479
3480;; Check whether to use long file names.
3481(defun gnus-use-long-file-name (symbol)
3482 ;; The variable has to be set...
3483 (and gnus-use-long-file-name
3484 ;; If it isn't a list, then we return t.
3485 (or (not (listp gnus-use-long-file-name))
3486 ;; If it is a list, and the list contains `symbol', we
3487 ;; return nil.
3488 (not (memq symbol gnus-use-long-file-name)))))
3489
3490;; Generate a unique new group name.
3491(defun gnus-generate-new-group-name (leaf)
3492 (let ((name leaf)
3493 (num 0))
01c52d31 3494 (while (gnus-group-entry name)
eec82323
LMI
3495 (setq name (concat leaf "<" (int-to-string (setq num (1+ num))) ">")))
3496 name))
3497
3498(defun gnus-ephemeral-group-p (group)
3499 "Say whether GROUP is ephemeral or not."
6748645f 3500 (gnus-group-get-parameter group 'quit-config t))
eec82323
LMI
3501
3502(defun gnus-group-quit-config (group)
3503 "Return the quit-config of GROUP."
6748645f 3504 (gnus-group-get-parameter group 'quit-config t))
eec82323
LMI
3505
3506(defun gnus-kill-ephemeral-group (group)
3507 "Remove ephemeral GROUP from relevant structures."
3508 (gnus-sethash group nil gnus-newsrc-hashtb))
3509
3510(defun gnus-simplify-mode-line ()
3511 "Make mode lines a bit simpler."
a8151ef7 3512 (setq mode-line-modified (cdr gnus-mode-line-modified))
eec82323
LMI
3513 (when (listp mode-line-format)
3514 (make-local-variable 'mode-line-format)
3515 (setq mode-line-format (copy-sequence mode-line-format))
3516 (when (equal (nth 3 mode-line-format) " ")
3517 (setcar (nthcdr 3 mode-line-format) " "))))
3518
3519;;; Servers and groups.
3520
3521(defsubst gnus-server-add-address (method)
3522 (let ((method-name (symbol-name (car method))))
3523 (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
3524 (not (assq (intern (concat method-name "-address")) method))
3525 (memq 'physical-address (assq (car method)
3526 gnus-valid-select-methods)))
3527 (append method (list (list (intern (concat method-name "-address"))
3528 (nth 1 method))))
3529 method)))
3530
b890d447 3531(defsubst gnus-method-to-server (method &optional nocache)
14e20e13
MB
3532 (catch 'server-name
3533 (setq method (or method gnus-select-method))
3534
3535 ;; Perhaps it is already in the cache.
b890d447
MB
3536 (unless nocache
3537 (mapc (lambda (name-method)
3538 (if (equal (cdr name-method) method)
3539 (throw 'server-name (car name-method))))
3540 gnus-server-method-cache))
14e20e13
MB
3541
3542 (mapc
3543 (lambda (server-alist)
3544 (mapc (lambda (name-method)
01c52d31
MB
3545 (when (gnus-methods-equal-p (cdr name-method) method)
3546 (unless (member name-method gnus-server-method-cache)
3547 (push name-method gnus-server-method-cache))
3548 (throw 'server-name (car name-method))))
3549 server-alist))
3550 (list gnus-server-alist
3551 gnus-predefined-server-alist))
14e20e13
MB
3552
3553 (let* ((name (if (member (cadr method) '(nil ""))
01c52d31
MB
3554 (format "%s" (car method))
3555 (format "%s:%s" (car method) (cadr method))))
3556 (name-method (cons name method)))
14e20e13 3557 (unless (member name-method gnus-server-method-cache)
01c52d31 3558 (push name-method gnus-server-method-cache))
14e20e13
MB
3559 name)))
3560
23f87bed
MB
3561(defsubst gnus-server-to-method (server)
3562 "Map virtual server names to select methods."
3563 (or (and server (listp server) server)
3564 (cdr (assoc server gnus-server-method-cache))
3565 (let ((result
3566 (or
3567 ;; Perhaps this is the native server?
3568 (and (equal server "native") gnus-select-method)
3569 ;; It should be in the server alist.
3570 (cdr (assoc server gnus-server-alist))
3571 ;; It could be in the predefined server alist.
3572 (cdr (assoc server gnus-predefined-server-alist))
3573 ;; If not, we look through all the opened server
3574 ;; to see whether we can find it there.
3575 (let ((opened gnus-opened-servers))
3576 (while (and opened
3577 (not (equal server (format "%s:%s" (caaar opened)
3578 (cadaar opened)))))
3579 (pop opened))
3580 (caar opened))
3581 ;; It could be a named method, search all servers
3582 (let ((servers gnus-secondary-select-methods))
3583 (while (and servers
3584 (not (equal server (format "%s:%s" (caar servers)
3585 (cadar servers)))))
3586 (pop servers))
3587 (car servers))
fdc90613
MB
3588 ;; This could be some sort of foreign server that I
3589 ;; simply haven't opened (yet). Do a brute-force scan
3590 ;; of the entire gnus-newsrc-alist for the server name
3591 ;; of every method. As a side-effect, loads the
3592 ;; gnus-server-method-cache so this only happens once,
3593 ;; if at all.
3594 (let ((alist (cdr gnus-newsrc-alist))
3595 method match)
3596 (while alist
3597 (setq method (gnus-info-method (pop alist)))
3598 (when (and (not (stringp method))
3599 (equal server (gnus-method-to-server method)))
3600 (setq match method
3601 alist nil)))
3602 match))))
3603 (when result
3604 (push (cons server result) gnus-server-method-cache))
23f87bed
MB
3605 result)))
3606
eec82323
LMI
3607(defsubst gnus-server-get-method (group method)
3608 ;; Input either a server name, and extended server name, or a
3609 ;; select method, and return a select method.
3610 (cond ((stringp method)
3611 (gnus-server-to-method method))
3612 ((equal method gnus-select-method)
3613 gnus-select-method)
6748645f
LMI
3614 ((and (stringp (car method))
3615 group)
eec82323 3616 (gnus-server-extend-method group method))
6748645f
LMI
3617 ((and method
3618 (not group)
eec82323
LMI
3619 (equal (cadr method) ""))
3620 method)
3621 (t
3622 (gnus-server-add-address method))))
3623
eec82323
LMI
3624(defmacro gnus-method-equal (ss1 ss2)
3625 "Say whether two servers are equal."
3626 `(let ((s1 ,ss1)
3627 (s2 ,ss2))
3628 (or (equal s1 s2)
3629 (and (= (length s1) (length s2))
3630 (progn
3631 (while (and s1 (member (car s1) s2))
3632 (setq s1 (cdr s1)))
3633 (null s1))))))
3634
16409b0b
GM
3635(defun gnus-methods-equal-p (m1 m2)
3636 (let ((m1 (or m1 gnus-select-method))
3637 (m2 (or m2 gnus-select-method)))
3638 (or (equal m1 m2)
3639 (and (eq (car m1) (car m2))
3640 (or (not (memq 'address (assoc (symbol-name (car m1))
3641 gnus-valid-select-methods)))
3642 (equal (nth 1 m1) (nth 1 m2)))))))
3643
eec82323
LMI
3644(defun gnus-server-equal (m1 m2)
3645 "Say whether two methods are equal."
3646 (let ((m1 (cond ((null m1) gnus-select-method)
3647 ((stringp m1) (gnus-server-to-method m1))
3648 (t m1)))
3649 (m2 (cond ((null m2) gnus-select-method)
3650 ((stringp m2) (gnus-server-to-method m2))
3651 (t m2))))
3652 (gnus-method-equal m1 m2)))
3653
3654(defun gnus-servers-using-backend (backend)
3655 "Return a list of known servers using BACKEND."
3656 (let ((opened gnus-opened-servers)
3657 out)
3658 (while opened
3659 (when (eq backend (caaar opened))
3660 (push (caar opened) out))
3661 (pop opened))
3662 out))
3663
3664(defun gnus-archive-server-wanted-p ()
3665 "Say whether the user wants to use the archive server."
3666 (cond
3667 ((or (not gnus-message-archive-method)
3668 (not gnus-message-archive-group))
3669 nil)
3670 ((and gnus-message-archive-method gnus-message-archive-group)
3671 t)
3672 (t
3673 (let ((active (cadr (assq 'nnfolder-active-file
3674 gnus-message-archive-method))))
3675 (and active
3676 (file-exists-p active))))))
3677
23f87bed
MB
3678(defsubst gnus-method-to-server-name (method)
3679 (concat
3680 (format "%s" (car method))
3681 (when (and
3682 (or (assoc (format "%s" (car method))
3683 (gnus-methods-using 'address))
3684 (gnus-server-equal method gnus-message-archive-method))
3685 (nth 1 method)
3686 (not (string= (nth 1 method) "")))
3687 (concat "+" (nth 1 method)))))
3688
3689(defsubst gnus-method-to-full-server-name (method)
3690 (format "%s+%s" (car method) (nth 1 method)))
3691
3692(defun gnus-group-prefixed-name (group method &optional full)
3693 "Return the whole name from GROUP and METHOD.
3694Call with full set to get the fully qualified group name (even if the
3695server is native)."
3696 (when (stringp method)
3697 (setq method (gnus-server-to-method method)))
6748645f 3698 (if (or (not method)
23f87bed
MB
3699 (and (not full) (gnus-server-equal method "native"))
3700 ;;;!!! This might not be right. We'll see...
3701 ;(string-match ":" group)
3702 )
eec82323 3703 group
23f87bed
MB
3704 (concat (gnus-method-to-server-name method) ":" group)))
3705
3706(defun gnus-group-guess-prefixed-name (group)
3707 "Guess the whole name from GROUP and METHOD."
3708 (gnus-group-prefixed-name group (gnus-find-method-for-group
3709 group)))
3710
3711(defun gnus-group-full-name (group method)
3712 "Return the full name from GROUP and METHOD, even if the method is native."
3713 (gnus-group-prefixed-name group method t))
3714
3715(defun gnus-group-guess-full-name (group)
3716 "Guess the full name from GROUP, even if the method is native."
3717 (if (gnus-group-prefixed-p group)
3718 group
3719 (gnus-group-full-name group (gnus-find-method-for-group group))))
3720
3721(defun gnus-group-guess-full-name-from-command-method (group)
3722 "Guess the full name from GROUP, even if the method is native."
3723 (if (gnus-group-prefixed-p group)
3724 group
3725 (gnus-group-full-name group gnus-command-method)))
eec82323
LMI
3726
3727(defun gnus-group-real-prefix (group)
3728 "Return the prefix of the current group name."
23f87bed
MB
3729 (if (stringp group)
3730 (if (string-match "^[^:]+:" group)
3731 (substring group 0 (match-end 0))
3732 "")
3733 nil))
3734
3735(defun gnus-group-short-name (group)
3736 "Return the short group name."
3737 (let ((prefix (gnus-group-real-prefix group)))
3738 (if (< 0 (length prefix))
3739 (substring group (length prefix) nil)
3740 group)))
3741
3742(defun gnus-group-prefixed-p (group)
3743 "Return the prefix of the current group name."
3744 (< 0 (length (gnus-group-real-prefix group))))
3745
c7e9cfaf
GM
3746(declare-function gnus-group-decoded-name "gnus-group" (string))
3747
23f87bed
MB
3748(defun gnus-summary-buffer-name (group)
3749 "Return the summary buffer name of GROUP."
3750 (concat "*Summary " (gnus-group-decoded-name group) "*"))
eec82323
LMI
3751
3752(defun gnus-group-method (group)
3753 "Return the server or method used for selecting GROUP.
3754You should probably use `gnus-find-method-for-group' instead."
3755 (let ((prefix (gnus-group-real-prefix group)))
3756 (if (equal prefix "")
3757 gnus-select-method
3758 (let ((servers gnus-opened-servers)
3759 (server "")
3760 backend possible found)
3761 (if (string-match "^[^\\+]+\\+" prefix)
3762 (setq backend (intern (substring prefix 0 (1- (match-end 0))))
3763 server (substring prefix (match-end 0) (1- (length prefix))))
3764 (setq backend (intern (substring prefix 0 (1- (length prefix))))))
3765 (while servers
3766 (when (eq (caaar servers) backend)
3767 (setq possible (caar servers))
3768 (when (equal (cadaar servers) server)
3769 (setq found (caar servers))))
3770 (pop servers))
3771 (or (car (rassoc found gnus-server-alist))
3772 found
3773 (car (rassoc possible gnus-server-alist))
3774 possible
3775 (list backend server))))))
3776
16409b0b
GM
3777(defsubst gnus-native-method-p (method)
3778 "Return whether METHOD is the native select method."
3779 (gnus-method-equal method gnus-select-method))
3780
eec82323
LMI
3781(defsubst gnus-secondary-method-p (method)
3782 "Return whether METHOD is a secondary select method."
3783 (let ((methods gnus-secondary-select-methods)
23f87bed 3784 (gmethod (inline (gnus-server-get-method nil method))))
eec82323 3785 (while (and methods
16409b0b 3786 (not (gnus-method-equal
23f87bed 3787 (inline (gnus-server-get-method nil (car methods)))
16409b0b 3788 gmethod)))
eec82323
LMI
3789 (setq methods (cdr methods)))
3790 methods))
3791
16409b0b
GM
3792(defun gnus-method-simplify (method)
3793 "Return the shortest uniquely identifying string or method for METHOD."
3794 (cond ((stringp method)
3795 method)
3796 ((gnus-native-method-p method)
3797 nil)
3798 ((gnus-secondary-method-p method)
3799 (format "%s:%s" (nth 0 method) (nth 1 method)))
3800 (t
3801 method)))
3802
6748645f
LMI
3803(defun gnus-groups-from-server (server)
3804 "Return a list of all groups that are fetched from SERVER."
3805 (let ((alist (cdr gnus-newsrc-alist))
3806 info groups)
3807 (while (setq info (pop alist))
3808 (when (gnus-server-equal (gnus-info-method info) server)
3809 (push (gnus-info-group info) groups)))
3810 (sort groups 'string<)))
3811
eec82323
LMI
3812(defun gnus-group-foreign-p (group)
3813 "Say whether a group is foreign or not."
3814 (and (not (gnus-group-native-p group))
3815 (not (gnus-group-secondary-p group))))
3816
3817(defun gnus-group-native-p (group)
3818 "Say whether the group is native or not."
3819 (not (string-match ":" group)))
3820
3821(defun gnus-group-secondary-p (group)
3822 "Say whether the group is secondary or not."
3823 (gnus-secondary-method-p (gnus-find-method-for-group group)))
3824
23f87bed
MB
3825(defun gnus-parameters-get-parameter (group)
3826 "Return the group parameters for GROUP from `gnus-parameters'."
e8beac8a
MB
3827 (let ((case-fold-search (if (eq gnus-parameters-case-fold-search 'default)
3828 case-fold-search
3829 gnus-parameters-case-fold-search))
3830 params-list)
23f87bed
MB
3831 (dolist (elem gnus-parameters)
3832 (when (string-match (car elem) group)
3833 (setq params-list
3834 (nconc (gnus-expand-group-parameters
3835 (car elem) (cdr elem) group)
3836 params-list))))
3837 params-list))
3838
3839(defun gnus-expand-group-parameter (match value group)
3840 "Use MATCH to expand VALUE in GROUP."
3841 (with-temp-buffer
3842 (insert group)
3843 (goto-char (point-min))
3844 (while (re-search-forward match nil t)
3845 (replace-match value))
3846 (buffer-string)))
3847
3848(defun gnus-expand-group-parameters (match parameters group)
3849 "Go through PARAMETERS and expand them according to the match data."
3850 (let (new)
3851 (dolist (elem parameters)
3852 (if (and (stringp (cdr elem))
3853 (string-match "\\\\[0-9&]" (cdr elem)))
3854 (push (cons (car elem)
3855 (gnus-expand-group-parameter match (cdr elem) group))
3856 new)
3857 (push elem new)))
3858 new))
3859
3860(defun gnus-group-fast-parameter (group symbol &optional allow-list)
3861 "For GROUP, return the value of SYMBOL.
3862
3863You should call this in the `gnus-group-buffer' buffer.
3864The function `gnus-group-find-parameter' will do that for you."
3865 ;; The speed trick: No cons'ing and quit early.
3866 (let* ((params (funcall gnus-group-get-parameter-function group))
3867 ;; Start easy, check the "real" group parameters.
3868 (simple-results
3869 (gnus-group-parameter-value params symbol allow-list t)))
3870 (if simple-results
3871 ;; Found results; return them.
3872 (car simple-results)
01c52d31 3873 ;; We didn't find it there, try `gnus-parameters'.
23f87bed
MB
3874 (let ((result nil)
3875 (head nil)
3876 (tail gnus-parameters))
3877 ;; A good old-fashioned non-cl loop.
3878 (while tail
3879 (setq head (car tail)
3880 tail (cdr tail))
3881 ;; The car is regexp matching for matching the group name.
3882 (when (string-match (car head) group)
3883 ;; The cdr is the parameters.
3884 (setq result (gnus-group-parameter-value (cdr head)
3885 symbol allow-list))
3886 (when result
3887 ;; Expand if necessary.
3888 (if (and (stringp result) (string-match "\\\\[0-9&]" result))
3889 (setq result (gnus-expand-group-parameter (car head)
3890 result group)))
3891 ;; Exit the loop early.
3892 (setq tail nil))))
3893 ;; Done.
3894 result))))
3895
6748645f 3896(defun gnus-group-find-parameter (group &optional symbol allow-list)
eec82323 3897 "Return the group parameters for GROUP.
23f87bed
MB
3898If SYMBOL, return the value of that symbol in the group parameters.
3899
3900If you call this function inside a loop, consider using the faster
3901`gnus-group-fast-parameter' instead."
eec82323
LMI
3902 (save-excursion
3903 (set-buffer gnus-group-buffer)
23f87bed
MB
3904 (if symbol
3905 (gnus-group-fast-parameter group symbol allow-list)
3906 (nconc
3907 (copy-sequence
3908 (funcall gnus-group-get-parameter-function group))
3909 (gnus-parameters-get-parameter group)))))
eec82323 3910
6748645f 3911(defun gnus-group-get-parameter (group &optional symbol allow-list)
eec82323 3912 "Return the group parameters for GROUP.
6748645f 3913If SYMBOL, return the value of that symbol in the group parameters.
3031d8b0 3914If ALLOW-LIST, also allow list as a result.
6748645f
LMI
3915Most functions should use `gnus-group-find-parameter', which
3916also examines the topic parameters."
eec82323
LMI
3917 (let ((params (gnus-info-params (gnus-get-info group))))
3918 (if symbol
6748645f 3919 (gnus-group-parameter-value params symbol allow-list)
eec82323
LMI
3920 params)))
3921
23f87bed
MB
3922(defun gnus-group-parameter-value (params symbol &optional
3923 allow-list present-p)
3031d8b0
MB
3924 "Return the value of SYMBOL in group PARAMS.
3925If ALLOW-LIST, also allow list as a result."
6748645f
LMI
3926 ;; We only wish to return group parameters (dotted lists) and
3927 ;; not local variables, which may have the same names.
3928 ;; But first we handle single elements...
3929 (or (car (memq symbol params))
3930 ;; Handle alist.
3931 (let (elem)
3932 (catch 'found
3933 (while (setq elem (pop params))
3934 (when (and (consp elem)
3935 (eq (car elem) symbol)
3936 (or allow-list
3937 (atom (cdr elem))))
23f87bed
MB
3938 (throw 'found (if present-p (list (cdr elem))
3939 (cdr elem)))))))))
eec82323
LMI
3940
3941(defun gnus-group-add-parameter (group param)
3942 "Add parameter PARAM to GROUP."
3943 (let ((info (gnus-get-info group)))
3944 (when info
3945 (gnus-group-remove-parameter group (if (consp param) (car param) param))
3946 ;; Cons the new param to the old one and update.
3947 (gnus-group-set-info (cons param (gnus-info-params info))
3948 group 'params))))
3949
3950(defun gnus-group-set-parameter (group name value)
3951 "Set parameter NAME to VALUE in GROUP."
3952 (let ((info (gnus-get-info group)))
3953 (when info
3954 (gnus-group-remove-parameter group name)
3955 (let ((old-params (gnus-info-params info))
3956 (new-params (list (cons name value))))
3957 (while old-params
3958 (when (or (not (listp (car old-params)))
3959 (not (eq (caar old-params) name)))
3960 (setq new-params (append new-params (list (car old-params)))))
3961 (setq old-params (cdr old-params)))
3962 (gnus-group-set-info new-params group 'params)))))
3963
3964(defun gnus-group-remove-parameter (group name)
3965 "Remove parameter NAME from GROUP."
3966 (let ((info (gnus-get-info group)))
3967 (when info
3968 (let ((params (gnus-info-params info)))
3969 (when params
3970 (setq params (delq name params))
3971 (while (assq name params)
6748645f 3972 (gnus-pull name params))
eec82323
LMI
3973 (gnus-info-set-params info params))))))
3974
3975(defun gnus-group-add-score (group &optional score)
3976 "Add SCORE to the GROUP score.
3977If SCORE is nil, add 1 to the score of GROUP."
3978 (let ((info (gnus-get-info group)))
3979 (when info
3980 (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
3981
eec82323
LMI
3982(defun gnus-short-group-name (group &optional levels)
3983 "Collapse GROUP name LEVELS.
3984Select methods are stripped and any remote host name is stripped down to
3985just the host name."
6748645f
LMI
3986 (let* ((name "")
3987 (foreign "")
3988 (depth 0)
3989 (skip 1)
eec82323 3990 (levels (or levels
16409b0b 3991 gnus-group-uncollapsed-levels
eec82323
LMI
3992 (progn
3993 (while (string-match "\\." group skip)
3994 (setq skip (match-end 0)
3995 depth (+ depth 1)))
3996 depth))))
16409b0b 3997 ;; Separate foreign select method from group name and collapse.
23f87bed 3998 ;; If method contains a server, collapse to non-domain server name,
16409b0b
GM
3999 ;; otherwise collapse to select method.
4000 (let* ((colon (string-match ":" group))
4001 (server (and colon (substring group 0 colon)))
4002 (plus (and server (string-match "+" server))))
4003 (when server
4004 (if plus
4005 (setq foreign (substring server (+ 1 plus)
4006 (string-match "\\." server))
4007 group (substring group (+ 1 colon)))
4008 (setq foreign server
4009 group (substring group (+ 1 colon))))
4010 (setq foreign (concat foreign ":")))
4011 ;; Collapse group name leaving LEVELS uncollapsed elements
4012 (let* ((slist (split-string group "/"))
4013 (slen (length slist))
4014 (dlist (split-string group "\\."))
4015 (dlen (length dlist))
4016 glist
4017 glen
4018 gsep
4019 res)
4020 (if (> slen dlen)
4021 (setq glist slist
4022 glen slen
4023 gsep "/")
4024 (setq glist dlist
4025 glen dlen
4026 gsep "."))
4027 (setq levels (- glen levels))
4028 (dolist (g glist)
4029 (push (if (>= (decf levels) 0)
4030 (if (zerop (length g))
4031 ""
4032 (substring g 0 1))
4033 g)
4034 res))
4035 (concat foreign (mapconcat 'identity (nreverse res) gsep))))))
eec82323
LMI
4036
4037(defun gnus-narrow-to-body ()
4038 "Narrow to the body of an article."
4039 (narrow-to-region
4040 (progn
4041 (goto-char (point-min))
4042 (or (search-forward "\n\n" nil t)
4043 (point-max)))
4044 (point-max)))
4045
4046\f
4047;;;
4048;;; Kill file handling.
4049;;;
4050
4051(defun gnus-apply-kill-file ()
4052 "Apply a kill file to the current newsgroup.
4053Returns the number of articles marked as read."
4054 (if (or (file-exists-p (gnus-newsgroup-kill-file nil))
4055 (file-exists-p (gnus-newsgroup-kill-file gnus-newsgroup-name)))
4056 (gnus-apply-kill-file-internal)
4057 0))
4058
4059(defun gnus-kill-save-kill-buffer ()
4060 (let ((file (gnus-newsgroup-kill-file gnus-newsgroup-name)))
4061 (when (get-file-buffer file)
4062 (save-excursion
4063 (set-buffer (get-file-buffer file))
4064 (when (buffer-modified-p)
4065 (save-buffer))
4066 (kill-buffer (current-buffer))))))
4067
4068(defcustom gnus-kill-file-name "KILL"
4069 "Suffix of the kill files."
4070 :group 'gnus-score-kill
4071 :group 'gnus-score-files
4072 :type 'string)
4073
4074(defun gnus-newsgroup-kill-file (newsgroup)
4075 "Return the name of a kill file name for NEWSGROUP.
4076If NEWSGROUP is nil, return the global kill file name instead."
4077 (cond
4078 ;; The global KILL file is placed at top of the directory.
4079 ((or (null newsgroup)
4080 (string-equal newsgroup ""))
4081 (expand-file-name gnus-kill-file-name
4082 gnus-kill-files-directory))
4083 ;; Append ".KILL" to newsgroup name.
4084 ((gnus-use-long-file-name 'not-kill)
4085 (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup)
4086 "." gnus-kill-file-name)
4087 gnus-kill-files-directory))
4088 ;; Place "KILL" under the hierarchical directory.
4089 (t
4090 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
4091 "/" gnus-kill-file-name)
4092 gnus-kill-files-directory))))
4093
4094;;; Server things.
4095
4096(defun gnus-member-of-valid (symbol group)
4097 "Find out if GROUP has SYMBOL as part of its \"valid\" spec."
4098 (memq symbol (assoc
4099 (symbol-name (car (gnus-find-method-for-group group)))
4100 gnus-valid-select-methods)))
4101
4102(defun gnus-method-option-p (method option)
4103 "Return non-nil if select METHOD has OPTION as a parameter."
4104 (when (stringp method)
4105 (setq method (gnus-server-to-method method)))
4106 (memq option (assoc (format "%s" (car method))
4107 gnus-valid-select-methods)))
4108
4109(defun gnus-similar-server-opened (method)
4110 (let ((opened gnus-opened-servers))
4111 (while (and method opened)
4112 (when (and (equal (cadr method) (cadaar opened))
16409b0b 4113 (equal (car method) (caaar opened))
eec82323
LMI
4114 (not (equal method (caar opened))))
4115 (setq method nil))
4116 (pop opened))
4117 (not method)))
4118
4119(defun gnus-server-extend-method (group method)
65a32076 4120 ;; This function "extends" a virtual server. If the server is
eec82323
LMI
4121 ;; "hello", and the select method is ("hello" (my-var "something"))
4122 ;; in the group "alt.alt", this will result in a new virtual server
4123 ;; called "hello+alt.alt".
4124 (if (or (not (inline (gnus-similar-server-opened method)))
4125 (not (cddr method)))
4126 method
4127 `(,(car method) ,(concat (cadr method) "+" group)
4128 (,(intern (format "%s-address" (car method))) ,(cadr method))
4129 ,@(cddr method))))
4130
4131(defun gnus-server-status (method)
4132 "Return the status of METHOD."
4133 (nth 1 (assoc method gnus-opened-servers)))
4134
4135(defun gnus-group-name-to-method (group)
4136 "Guess a select method based on GROUP."
4137 (if (string-match ":" group)
4138 (let ((server (substring group 0 (match-beginning 0))))
4139 (if (string-match "\\+" server)
4140 (list (intern (substring server 0 (match-beginning 0)))
4141 (substring server (match-end 0)))
4142 (list (intern server) "")))
4143 gnus-select-method))
4144
23f87bed
MB
4145(defun gnus-server-string (server)
4146 "Return a readable string that describes SERVER."
4147 (let* ((server (gnus-server-to-method server))
4148 (address (nth 1 server)))
4149 (if (and address
4150 (not (zerop (length address))))
4151 (format "%s using %s" address (car server))
4152 (format "%s" (car server)))))
4153
eec82323
LMI
4154(defun gnus-find-method-for-group (group &optional info)
4155 "Find the select method that GROUP uses."
4156 (or gnus-override-method
4157 (and (not group)
4158 gnus-select-method)
6c5d6b6c 4159 (and (not (gnus-group-entry group))
01c52d31
MB
4160 ;; Killed or otherwise unknown group.
4161 (or
4162 ;; If we know a virtual server by that name, return its method.
4163 (gnus-server-to-method (gnus-group-server group))
4164 ;; Guess a new method as last resort.
4165 (gnus-group-name-to-method group)))
eec82323
LMI
4166 (let ((info (or info (gnus-get-info group)))
4167 method)
4168 (if (or (not info)
4169 (not (setq method (gnus-info-method info)))
4170 (equal method "native"))
4171 gnus-select-method
4172 (setq method
4173 (cond ((stringp method)
4174 (inline (gnus-server-to-method method)))
4175 ((stringp (cadr method))
4176 (inline (gnus-server-extend-method group method)))
4177 (t
4178 method)))
4179 (cond ((equal (cadr method) "")
4180 method)
4181 ((null (cadr method))
4182 (list (car method) ""))
4183 (t
4184 (gnus-server-add-address method)))))))
4185
eec82323
LMI
4186(defun gnus-methods-using (feature)
4187 "Find all methods that have FEATURE."
4188 (let ((valids gnus-valid-select-methods)
4189 outs)
4190 (while valids
4191 (when (memq feature (car valids))
4192 (push (car valids) outs))
4193 (setq valids (cdr valids)))
4194 outs))
4195
8654e13a
MB
4196(eval-and-compile
4197 (autoload 'message-y-or-n-p "message" nil nil 'macro))
4198
eec82323
LMI
4199(defun gnus-read-group (prompt &optional default)
4200 "Prompt the user for a group name.
16409b0b 4201Disallow invalid group names."
eec82323
LMI
4202 (let ((prefix "")
4203 group)
4204 (while (not group)
a1506d29 4205 (when (string-match
16409b0b 4206 gnus-invalid-group-regexp
eec82323
LMI
4207 (setq group (read-string (concat prefix prompt)
4208 (cons (or default "") 0)
4209 'gnus-group-history)))
23f87bed
MB
4210 (let ((match (match-string 0 group)))
4211 ;; Might be okay (e.g. for nnimap), so ask the user:
4212 (unless (and (not (string-match "^$\\|:" match))
4213 (message-y-or-n-p
4214 "Proceed and create group anyway? " t
4215"The group name \"" group "\" contains a forbidden character: \"" match "\".
4216
4217Usually, it's dangerous to create a group with this name, because it's not
4218supported by all back ends and servers. On IMAP servers it should work,
4219though. If you are really sure, you can proceed anyway and create the group.
4220
4221You may customize the variable `gnus-invalid-group-regexp', which currently is
4222set to \"" gnus-invalid-group-regexp
4223"\", if you want to get rid of this query permanently."))
4224 (setq prefix (format "Invalid group name: \"%s\". " group)
4225 group nil)))))
eec82323
LMI
4226 group))
4227
4228(defun gnus-read-method (prompt)
4229 "Prompt the user for a method.
4230Allow completion over sensible values."
23f87bed
MB
4231 (let* ((open-servers
4232 (mapcar (lambda (i) (cons (format "%s:%s" (caar i) (cadar i)) i))
4233 gnus-opened-servers))
4234 (valid-methods
4235 (let (methods)
4236 (dolist (method gnus-valid-select-methods)
4237 (if (or (memq 'prompt-address method)
4238 (not (assoc (format "%s:" (car method)) open-servers)))
4239 (push method methods)))
4240 methods))
4241 (servers
4242 (append valid-methods
4243 open-servers
6748645f
LMI
4244 gnus-predefined-server-alist
4245 gnus-server-alist))
4246 (method
4247 (completing-read
4248 prompt servers
4249 nil t nil 'gnus-method-history)))
eec82323
LMI
4250 (cond
4251 ((equal method "")
4252 (setq method gnus-select-method))
4253 ((assoc method gnus-valid-select-methods)
16409b0b
GM
4254 (let ((address (if (memq 'prompt-address
4255 (assoc method gnus-valid-select-methods))
4256 (read-string "Address: ")
4257 "")))
23f87bed 4258 (or (cadr (assoc (format "%s:%s" method address) open-servers))
16409b0b 4259 (list (intern method) address))))
6748645f 4260 ((assoc method servers)
eec82323
LMI
4261 method)
4262 (t
4263 (list (intern method) "")))))
4264
23f87bed
MB
4265;;; Agent functions
4266
b890d447 4267(defun gnus-agent-method-p (method-or-server)
23f87bed 4268 "Say whether METHOD is covered by the agent."
b890d447
MB
4269 (or (eq (car gnus-agent-method-p-cache) method-or-server)
4270 (let* ((method (if (stringp method-or-server)
4271 (gnus-server-to-method method-or-server)
4272 method-or-server))
4273 (server (gnus-method-to-server method t)))
4274 (setq gnus-agent-method-p-cache
4275 (cons method-or-server
4276 (member server gnus-agent-covered-methods)))))
23f87bed
MB
4277 (cdr gnus-agent-method-p-cache))
4278
4279(defun gnus-online (method)
4280 (not
4281 (if gnus-plugged
4282 (eq (cadr (assoc method gnus-opened-servers)) 'offline)
4283 (gnus-agent-method-p method))))
4284
eec82323
LMI
4285;;; User-level commands.
4286
4287;;;###autoload
4288(defun gnus-slave-no-server (&optional arg)
23f87bed 4289 "Read network news as a slave, without connecting to the local server."
eec82323
LMI
4290 (interactive "P")
4291 (gnus-no-server arg t))
4292
4293;;;###autoload
4294(defun gnus-no-server (&optional arg slave)
4295 "Read network news.
23f87bed
MB
4296If ARG is a positive number, Gnus will use that as the startup
4297level. If ARG is nil, Gnus will be started at level 2. If ARG is
4298non-nil and not a positive number, Gnus will prompt the user for the
4299name of an NNTP server to use.
4300As opposed to `gnus', this command will not connect to the local
4301server."
eec82323
LMI
4302 (interactive "P")
4303 (gnus-no-server-1 arg slave))
4304
4305;;;###autoload
4306(defun gnus-slave (&optional arg)
4307 "Read news as a slave."
4308 (interactive "P")
4309 (gnus arg nil 'slave))
4310
4311;;;###autoload
23f87bed
MB
4312(defun gnus-other-frame (&optional arg display)
4313 "Pop up a frame to read news.
4314This will call one of the Gnus commands which is specified by the user
4315option `gnus-other-frame-function' (default `gnus') with the argument
4316ARG if Gnus is not running, otherwise just pop up a Gnus frame. The
4317optional second argument DISPLAY should be a standard display string
4318such as \"unix:0\" to specify where to pop up a frame. If DISPLAY is
4319omitted or the function `make-frame-on-display' is not available, the
4320current display is used."
eec82323 4321 (interactive "P")
23f87bed
MB
4322 (if (fboundp 'make-frame-on-display)
4323 (unless display
4324 (setq display (gnus-frame-or-window-display-name (selected-frame))))
4325 (setq display nil))
4326 (let ((alive (gnus-alive-p)))
4327 (unless (and alive
4328 (catch 'found
4329 (walk-windows
4330 (lambda (window)
4331 (when (and (or (not display)
4332 (equal display
4333 (gnus-frame-or-window-display-name
4334 window)))
4335 (with-current-buffer (window-buffer window)
4336 (string-match "\\`gnus-"
4337 (symbol-name major-mode))))
4338 (gnus-select-frame-set-input-focus
4339 (setq gnus-other-frame-object (window-frame window)))
4340 (select-window window)
4341 (throw 'found t)))
4342 'ignore t)))
4343 (gnus-select-frame-set-input-focus
4344 (setq gnus-other-frame-object
4345 (if display
4346 (make-frame-on-display display gnus-other-frame-parameters)
4347 (make-frame gnus-other-frame-parameters))))
4348 (if alive
4349 (switch-to-buffer gnus-group-buffer)
4350 (funcall gnus-other-frame-function arg)
4351 (add-hook 'gnus-exit-gnus-hook
4352 '(lambda nil
4353 (when (and (frame-live-p gnus-other-frame-object)
4354 (cdr (frame-list)))
4355 (delete-frame gnus-other-frame-object))
4356 (setq gnus-other-frame-object nil)))))))
eec82323
LMI
4357
4358;;;###autoload
4359(defun gnus (&optional arg dont-connect slave)
4360 "Read network news.
4361If ARG is non-nil and a positive number, Gnus will use that as the
23f87bed 4362startup level. If ARG is non-nil and not a positive number, Gnus will
eec82323
LMI
4363prompt the user for the name of an NNTP server to use."
4364 (interactive "P")
23f87bed
MB
4365 (unless (byte-code-function-p (symbol-function 'gnus))
4366 (message "You should byte-compile Gnus")
4367 (sit-for 2))
eec82323
LMI
4368 (gnus-1 arg dont-connect slave))
4369
4370;; Allow redefinition of Gnus functions.
4371
4372(gnus-ems-redefine)
4373
4374(provide 'gnus)
4375
cbee283d 4376;; arch-tag: acebeeab-f331-4f8f-a7ea-89c58c84f636
eec82323 4377;;; gnus.el ends here