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