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