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