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