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