* gnus.art.el (gnus-treat-predicate): Don't follow the Change of Oort Gnus
[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-uncached-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-uncached-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-uncached-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-bogofilter "bogofilter"
1833   "The Bogofilter summary exit spam processor.
1834 Only applicable to spam groups.")
1835
1836 (defvar gnus-group-spam-exit-processor-blacklist "blacklist"
1837   "The Blacklist summary exit spam processor.
1838 Only applicable to spam groups.")
1839
1840 (defvar gnus-group-ham-exit-processor-whitelist "whitelist"
1841   "The whitelist summary exit ham processor.
1842 Only applicable to non-spam (unclassified and ham) groups.")
1843
1844 (defvar gnus-group-ham-exit-processor-BBDB "bbdb"
1845   "The BBDB summary exit ham processor.
1846 Only applicable to non-spam (unclassified and ham) groups.")
1847
1848 (gnus-define-group-parameter
1849  spam-process
1850  :type list
1851  :parameter-type '(choice :tag "Spam Summary Exit Processor"
1852                           :value nil
1853                           (list :tag "Spam Summary Exit Processor Choices"
1854                            (set 
1855                             (variable-item gnus-group-spam-exit-processor-ifile)
1856                             (variable-item gnus-group-spam-exit-processor-bogofilter)
1857                             (variable-item gnus-group-spam-exit-processor-blacklist)
1858                             (variable-item gnus-group-ham-exit-processor-whitelist)
1859                             (variable-item gnus-group-ham-exit-processor-BBDB))))
1860  :function-document
1861  "Which spam or ham processors will be applied to the GROUP articles at summary exit."
1862  :variable gnus-spam-process-newsgroups
1863  :variable-default nil
1864  :variable-document
1865  "*Groups in which to automatically process spam or ham articles with
1866 a backend on summary exit.  If non-nil, this should be a list of group
1867 name regexps that should match all groups in which to do automatic
1868 spam processing, associated with the appropriate processor.  This only makes sense
1869 for mail groups."
1870  :variable-group spam
1871  :variable-type '(repeat :tag "Spam/Ham Processors" 
1872                          (list :tag "Spam Summary Exit Processor Choices"
1873                           (regexp :tag "Group Regexp") 
1874                           (set :tag "Spam/Ham Summary Exit Processor"
1875                                (variable-item gnus-group-spam-exit-processor-ifile)
1876                                (variable-item gnus-group-spam-exit-processor-bogofilter)
1877                                (variable-item gnus-group-spam-exit-processor-blacklist)
1878                                (variable-item gnus-group-ham-exit-processor-whitelist)
1879                                (variable-item gnus-group-ham-exit-processor-BBDB))))
1880  :parameter-document
1881  "Which spam processors will be applied to the spam or ham GROUP articles at summary exit.")
1882
1883 (gnus-define-group-parameter
1884  spam-process-destination
1885  :parameter-type '(choice :tag "Destination for spam-processed articles at summary exit"
1886                           (string :tag "Move to a group")
1887                           (other :tag "Expire" nil))
1888  :function-document
1889  "Where spam-processed articles will go at summary exit."
1890  :variable gnus-spam-process-destinations
1891  :variable-default nil
1892  :variable-document
1893  "*Groups in which to explicitly send spam-processed articles to
1894 another group, or expire them (the default).  If non-nil, this should
1895 be a list of group name regexps that should match all groups in which
1896 to do spam-processed article moving, associated with the destination
1897 group or `nil' for explicit expiration.  This only makes sense for
1898 mail groups."
1899  :variable-group spam
1900  :variable-type '(repeat :tag "Spam-processed articles destination" 
1901                          (list
1902                           (regexp :tag "Group Regexp") 
1903                           (choice :tag "Destination for spam-processed articles at summary exit"
1904                                   (string :tag "Move to a group")
1905                                   (other :tag "Expire" nil))))
1906  :parameter-document
1907  "Where spam-processed articles will go at summary exit.")
1908
1909 (defcustom gnus-group-uncollapsed-levels 1
1910   "Number of group name elements to leave alone when making a short group name."
1911   :group 'gnus-group-visual
1912   :type 'integer)
1913
1914 (defcustom gnus-group-use-permanent-levels nil
1915   "*If non-nil, once you set a level, Gnus will use this level."
1916   :group 'gnus-group-levels
1917   :type 'boolean)
1918
1919 ;; Hooks.
1920
1921 (defcustom gnus-load-hook nil
1922   "A hook run while Gnus is loaded."
1923   :group 'gnus-start
1924   :type 'hook)
1925
1926 (defcustom gnus-apply-kill-hook '(gnus-apply-kill-file)
1927   "A hook called to apply kill files to a group.
1928 This hook is intended to apply a kill file to the selected newsgroup.
1929 The function `gnus-apply-kill-file' is called by default.
1930
1931 Since a general kill file is too heavy to use only for a few
1932 newsgroups, I recommend you to use a lighter hook function.  For
1933 example, if you'd like to apply a kill file to articles which contains
1934 a string `rmgroup' in subject in newsgroup `control', you can use the
1935 following hook:
1936
1937  (setq gnus-apply-kill-hook
1938       (list
1939         (lambda ()
1940           (cond ((string-match \"control\" gnus-newsgroup-name)
1941                  (gnus-kill \"Subject\" \"rmgroup\")
1942                  (gnus-expunge \"X\"))))))"
1943   :group 'gnus-score-kill
1944   :options '(gnus-apply-kill-file)
1945   :type 'hook)
1946
1947 (defcustom gnus-group-change-level-function nil
1948   "Function run when a group level is changed.
1949 It is called with three parameters -- GROUP, LEVEL and OLDLEVEL."
1950   :group 'gnus-group-levels
1951   :type 'function)
1952
1953 ;;; Face thingies.
1954
1955 (defcustom gnus-visual
1956   '(summary-highlight group-highlight article-highlight
1957                       mouse-face
1958                       summary-menu group-menu article-menu
1959                       tree-highlight menu highlight
1960                       browse-menu server-menu
1961                       page-marker tree-menu binary-menu pick-menu
1962                       grouplens-menu)
1963   "*Enable visual features.
1964 If `visual' is disabled, there will be no menus and few faces.  Most of
1965 the visual customization options below will be ignored.  Gnus will use
1966 less space and be faster as a result.
1967
1968 This variable can also be a list of visual elements to switch on.  For
1969 instance, to switch off all visual things except menus, you can say:
1970
1971    (setq gnus-visual '(menu))
1972
1973 Valid elements include `summary-highlight', `group-highlight',
1974 `article-highlight', `mouse-face', `summary-menu', `group-menu',
1975 `article-menu', `tree-highlight', `menu', `highlight', `browse-menu',
1976 `server-menu', `page-marker', `tree-menu', `binary-menu', `pick-menu',
1977 and `grouplens-menu'."
1978   :group 'gnus-meta
1979   :group 'gnus-visual
1980   :type '(set (const summary-highlight)
1981               (const group-highlight)
1982               (const article-highlight)
1983               (const mouse-face)
1984               (const summary-menu)
1985               (const group-menu)
1986               (const article-menu)
1987               (const tree-highlight)
1988               (const menu)
1989               (const highlight)
1990               (const browse-menu)
1991               (const server-menu)
1992               (const page-marker)
1993               (const tree-menu)
1994               (const binary-menu)
1995               (const pick-menu)
1996               (const grouplens-menu)))
1997
1998 ;; Byte-compiler warning.
1999 (defvar gnus-visual)
2000 ;; Find out whether the gnus-visual TYPE is wanted.
2001 (defun gnus-visual-p (&optional type class)
2002   (and gnus-visual                      ; Has to be non-nil, at least.
2003        (if (not type)                   ; We don't care about type.
2004            gnus-visual
2005          (if (listp gnus-visual)        ; It's a list, so we check it.
2006              (or (memq type gnus-visual)
2007                  (memq class gnus-visual))
2008            t))))
2009
2010 (defcustom gnus-mouse-face
2011   (condition-case ()
2012       (if (gnus-visual-p 'mouse-face 'highlight)
2013           (if (boundp 'gnus-mouse-face)
2014               (or gnus-mouse-face 'highlight)
2015             'highlight)
2016         'default)
2017     (error 'highlight))
2018   "*Face used for group or summary buffer mouse highlighting.
2019 The line beneath the mouse pointer will be highlighted with this
2020 face."
2021   :group 'gnus-visual
2022   :type 'face)
2023
2024 (defcustom gnus-article-save-directory gnus-directory
2025   "*Name of the directory articles will be saved in (default \"~/News\")."
2026   :group 'gnus-article-saving
2027   :type 'directory)
2028
2029 (defvar gnus-plugged t
2030   "Whether Gnus is plugged or not.")
2031
2032 (defcustom gnus-agent-cache t
2033   "Whether Gnus use agent cache.
2034 You also need to enable `gnus-agent'."
2035   :version "21.3"
2036   :group 'gnus-agent
2037   :type 'boolean)
2038
2039 (defcustom gnus-default-charset 'iso-8859-1
2040   "Default charset assumed to be used when viewing non-ASCII characters.
2041 This variable is overridden on a group-to-group basis by the
2042 gnus-group-charset-alist variable and is only used on groups not
2043 covered by that variable."
2044   :type 'symbol
2045   :group 'gnus-charset)
2046
2047 (defcustom gnus-agent t
2048   "Whether we want to use the Gnus agent or not.
2049 Putting (gnus-agentize) in ~/.gnus is obsolete by (setq gnus-agent t)."
2050   :version "21.3"
2051   :group 'gnus-agent
2052   :type 'boolean)
2053
2054 (defcustom gnus-other-frame-function 'gnus
2055   "Function called by the command `gnus-other-frame'."
2056   :group 'gnus-start
2057   :type '(choice (function-item gnus)
2058                  (function-item gnus-no-server)
2059                  (function-item gnus-slave)
2060                  (function-item gnus-slave-no-server)))
2061
2062 (defcustom gnus-other-frame-parameters nil
2063   "Frame parameters used by `gnus-other-frame' to create a Gnus frame.
2064 This should be an alist for FSF Emacs, or a plist for XEmacs."
2065   :group 'gnus-start
2066   :type (if (featurep 'xemacs)
2067             '(repeat (list :inline t :format "%v"
2068                            (symbol :tag "Property")
2069                            (sexp :tag "Value")))
2070           '(repeat (cons :format "%v"
2071                          (symbol :tag "Parameter")
2072                          (sexp :tag "Value")))))
2073
2074 \f
2075 ;;; Internal variables
2076
2077 (defvar gnus-agent-gcc-header "X-Gnus-Agent-Gcc")
2078 (defvar gnus-agent-meta-information-header "X-Gnus-Agent-Meta-Information")
2079 (defvar gnus-draft-meta-information-header "X-Draft-From")
2080 (defvar gnus-group-get-parameter-function 'gnus-group-get-parameter)
2081 (defvar gnus-original-article-buffer " *Original Article*")
2082 (defvar gnus-newsgroup-name nil)
2083 (defvar gnus-ephemeral-servers nil)
2084 (defvar gnus-server-method-cache nil)
2085
2086 (defvar gnus-agent-fetching nil
2087   "Whether Gnus agent is in fetching mode.")
2088
2089 (defvar gnus-agent-covered-methods nil)
2090
2091 (defvar gnus-command-method nil
2092   "Dynamically bound variable that says what the current back end is.")
2093
2094 (defvar gnus-current-select-method nil
2095   "The current method for selecting a newsgroup.")
2096
2097 (defvar gnus-tree-buffer "*Tree*"
2098   "Buffer where Gnus thread trees are displayed.")
2099
2100 ;; Dummy variable.
2101 (defvar gnus-use-generic-from nil)
2102
2103 ;; Variable holding the user answers to all method prompts.
2104 (defvar gnus-method-history nil)
2105
2106 ;; Variable holding the user answers to all mail method prompts.
2107 (defvar gnus-mail-method-history nil)
2108
2109 ;; Variable holding the user answers to all group prompts.
2110 (defvar gnus-group-history nil)
2111
2112 (defvar gnus-server-alist nil
2113   "List of available servers.")
2114
2115 (defcustom gnus-cache-directory
2116   (nnheader-concat gnus-directory "cache/")
2117   "*The directory where cached articles will be stored."
2118   :group 'gnus-cache
2119   :type 'directory)
2120
2121 (defvar gnus-predefined-server-alist
2122   `(("cache"
2123      nnspool "cache"
2124      (nnspool-spool-directory ,gnus-cache-directory)
2125      (nnspool-nov-directory ,gnus-cache-directory)
2126      (nnspool-active-file
2127       ,(nnheader-concat gnus-cache-directory "active"))))
2128   "List of predefined (convenience) servers.")
2129
2130 (defvar gnus-topic-indentation "");; Obsolete variable.
2131
2132 (defconst gnus-article-mark-lists
2133   '((marked . tick) (replied . reply)
2134     (expirable . expire) (killed . killed)
2135     (bookmarks . bookmark) (dormant . dormant)
2136     (scored . score) (saved . save)
2137     (cached . cache) (downloadable . download)
2138     (unsendable . unsend) (forwarded . forward)
2139     (recent . recent) (seen . seen)))
2140
2141 (defconst gnus-article-special-mark-lists
2142   '((seen range)
2143     (killed range)
2144     (bookmark tuple)
2145     (score tuple)))
2146
2147 ;; Propagate flags to server, with the following exceptions:
2148 ;; `seen' is private to each gnus installation
2149 ;; `cache' is a internal gnus flag for each gnus installation
2150 ;; `download' is a agent flag private to each gnus installation
2151 ;; `unsend' are for nndraft groups only
2152 ;; `score' is not a proper mark
2153 ;; `bookmark': don't propagated it, or fix the bug in update-mark.
2154 (defconst gnus-article-unpropagated-mark-lists
2155   '(seen cache download unsend score bookmark)
2156   "Marks that shouldn't be propagated to back ends.
2157 Typical marks are those that make no sense in a standalone back end,
2158 such as a mark that says whether an article is stored in the cache
2159 \(which doesn't make sense in a standalone back end).")
2160
2161 (defvar gnus-headers-retrieved-by nil)
2162 (defvar gnus-article-reply nil)
2163 (defvar gnus-override-method nil)
2164 (defvar gnus-article-check-size nil)
2165 (defvar gnus-opened-servers nil)
2166
2167 (defvar gnus-current-kill-article nil)
2168
2169 (defvar gnus-have-read-active-file nil)
2170
2171 (defconst gnus-maintainer
2172   "semi-gnus-ja@meadowy.org (T-gnus Bugfixing Girls + Boys)"
2173   "The mail address of the T-gnus maintainers.")
2174
2175 (defcustom gnus-info-filename nil
2176   "*Controls language of gnus Info.
2177 If nil and current-language-environment is Japanese, go to gnus-ja.
2178 Otherwise go to corresponding Info.
2179 This variable can be nil, gnus or gnus-ja."
2180   :group 'gnus-start
2181   :type '(choice (const nil)
2182                  (const :tag "English" gnus)
2183                  (const :tag "Japanese" gnus-ja)))
2184
2185 (defvar gnus-info-nodes
2186   '((gnus-group-mode "Group Buffer")
2187     (gnus-summary-mode "Summary Buffer")
2188     (gnus-article-mode "Article Buffer")
2189     (gnus-server-mode "Server Buffer")
2190     (gnus-browse-mode "Browse Foreign Server")
2191     (gnus-tree-mode "Tree Display"))
2192   "Alist of major modes and related Info nodes.")
2193
2194 (defvar gnus-group-buffer "*Group*")
2195 (defvar gnus-summary-buffer "*Summary*")
2196 (defvar gnus-article-buffer "*Article*")
2197 (defvar gnus-server-buffer "*Server*")
2198
2199 (defvar gnus-slave nil
2200   "Whether this Gnus is a slave or not.")
2201
2202 (defvar gnus-batch-mode nil
2203   "Whether this Gnus is running in batch mode or not.")
2204
2205 (defvar gnus-variable-list
2206   '(gnus-newsrc-options gnus-newsrc-options-n
2207                         gnus-newsrc-last-checked-date
2208                         gnus-newsrc-alist gnus-server-alist
2209                         gnus-killed-list gnus-zombie-list
2210                         gnus-topic-topology gnus-topic-alist
2211                         gnus-agent-covered-methods)
2212   "Gnus variables saved in the quick startup file.")
2213
2214 (defvar gnus-product-variable-file-list
2215   (let ((version (product-version (product-find 'gnus-vers)))
2216         (codesys (static-if (boundp 'MULE) '*ctext* 'ctext)))
2217     `(("strict-cache"
2218        ((product-version ,version)
2219         (emacs-version)
2220         (correct-string-widths))
2221        binary
2222        gnus-format-specs-compiled)
2223       ("cache"
2224        ((product-version ,version)
2225         (emacs-version)
2226         (correct-string-widths))
2227        ,codesys
2228        gnus-format-specs)))
2229   "Alist of the methods for checking whether the contents of the T-gnus
2230 quick startup files are valid.  One is for the byte-compiled format
2231 specifications, the other is for the source form.  Each element should
2232 be a list which looks like follows:
2233
2234 \(\"FILE_NAME\"
2235  ((VARIABLE EXPECTED_VALUE_or_NIL)
2236   (VARIABLE EXPECTED_VALUE_or_NIL)
2237   ...)
2238  CODING-SYSTEM_FOR_READING_FILE
2239  SYMBOL_OF_FORMAT_SPECS)")
2240
2241 (defcustom gnus-compile-user-specs t
2242   "If non-nil, the user-defined format specs will be byte-compiled
2243 automatically.
2244 It has an effect on the values of `gnus-*-line-format-spec'."
2245   :group 'gnus
2246   :type 'boolean)
2247
2248 (defvar gnus-newsrc-alist nil
2249   "Assoc list of read articles.
2250 gnus-newsrc-hashtb should be kept so that both hold the same information.")
2251
2252 (defvar gnus-newsrc-hashtb nil
2253   "Hashtable of gnus-newsrc-alist.")
2254
2255 (defvar gnus-killed-list nil
2256   "List of killed newsgroups.")
2257
2258 (defvar gnus-killed-hashtb nil
2259   "Hash table equivalent of gnus-killed-list.")
2260
2261 (defvar gnus-zombie-list nil
2262   "List of almost dead newsgroups.")
2263
2264 (defvar gnus-description-hashtb nil
2265   "Descriptions of newsgroups.")
2266
2267 (defvar gnus-list-of-killed-groups nil
2268   "List of newsgroups that have recently been killed by the user.")
2269
2270 (defvar gnus-active-hashtb nil
2271   "Hashtable of active articles.")
2272
2273 (defvar gnus-moderated-hashtb nil
2274   "Hashtable of moderated newsgroups.")
2275
2276 ;; Save window configuration.
2277 (defvar gnus-prev-winconf nil)
2278
2279 (defvar gnus-reffed-article-number nil)
2280
2281 ;;; Let the byte-compiler know that we know about this variable.
2282 (defvar rmail-default-rmail-file)
2283
2284 (defvar gnus-dead-summary nil)
2285
2286 (defvar gnus-invalid-group-regexp "[: `'\"/]\\|^$"
2287   "Regexp matching invalid groups.")
2288
2289 (defvar gnus-other-frame-object nil
2290   "A frame object which will be created by `gnus-other-frame'.")
2291
2292 ;;; End of variables.
2293
2294 ;; Define some autoload functions Gnus might use.
2295 (eval-and-compile
2296
2297   ;; This little mapcar goes through the list below and marks the
2298   ;; symbols in question as autoloaded functions.
2299   (mapcar
2300    (lambda (package)
2301      (let ((interactive (nth 1 (memq ':interactive package))))
2302        (mapcar
2303         (lambda (function)
2304           (let (keymap)
2305             (when (consp function)
2306               (setq keymap (car (memq 'keymap function)))
2307               (setq function (car function)))
2308             (unless (fboundp function)
2309               (autoload function (car package) nil interactive keymap))))
2310         (if (eq (nth 1 package) ':interactive)
2311             (nthcdr 3 package)
2312           (cdr package)))))
2313    '(("info" :interactive t Info-goto-node)
2314      ("pp" pp-to-string)
2315      ("ps-print" ps-print-preprint)
2316      ("message" :interactive t
2317       message-send-and-exit message-yank-original)
2318      ("babel" babel-as-string)
2319      ("nnmail" nnmail-split-fancy nnmail-article-group)
2320      ("nnvirtual" nnvirtual-catchup-group nnvirtual-convert-headers)
2321      ("rmailout" rmail-output rmail-output-to-rmail-file)
2322      ("rmail" rmail-insert-rmail-file-header rmail-count-new-messages
2323       rmail-show-message rmail-summary-exists
2324       rmail-select-summary rmail-update-summary)
2325      ("gnus-audio" :interactive t gnus-audio-play)
2326      ("gnus-xmas" gnus-xmas-splash)
2327      ("gnus-soup" :interactive t
2328       gnus-group-brew-soup gnus-brew-soup gnus-soup-add-article
2329       gnus-soup-send-replies gnus-soup-save-areas gnus-soup-pack-packet)
2330      ("nnsoup" nnsoup-pack-replies)
2331      ("score-mode" :interactive t gnus-score-mode)
2332      ("gnus-mh" gnus-summary-save-article-folder
2333       gnus-Folder-save-name gnus-folder-save-name)
2334      ("gnus-mh" :interactive t gnus-summary-save-in-folder)
2335      ("gnus-demon" gnus-demon-add-nocem gnus-demon-add-scanmail
2336       gnus-demon-add-rescan gnus-demon-add-scan-timestamps
2337       gnus-demon-add-disconnection gnus-demon-add-handler
2338       gnus-demon-remove-handler)
2339      ("gnus-demon" :interactive t
2340       gnus-demon-init gnus-demon-cancel)
2341      ("gnus-fun" gnus-convert-gray-x-face-to-xpm gnus-display-x-face-in-from
2342       gnus-convert-image-to-gray-x-face)
2343      ("gnus-salt" gnus-highlight-selected-tree gnus-possibly-generate-tree
2344       gnus-tree-open gnus-tree-close gnus-carpal-setup-buffer)
2345      ("gnus-nocem" gnus-nocem-scan-groups gnus-nocem-close
2346       gnus-nocem-unwanted-article-p)
2347      ("gnus-srvr" gnus-enter-server-buffer gnus-server-set-info
2348       gnus-server-server-name)
2349      ("gnus-srvr" gnus-browse-foreign-server)
2350      ("gnus-cite" :interactive t
2351       gnus-article-highlight-citation gnus-article-hide-citation-maybe
2352       gnus-article-hide-citation gnus-article-fill-cited-article
2353       gnus-article-hide-citation-in-followups)
2354      ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
2355       gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
2356       gnus-execute gnus-expunge gnus-batch-kill gnus-batch-score)
2357      ("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
2358       gnus-cache-possibly-remove-articles gnus-cache-request-article
2359       gnus-cache-retrieve-headers gnus-cache-possibly-alter-active
2360       gnus-cache-enter-remove-article gnus-cached-article-p
2361       gnus-cache-open gnus-cache-close gnus-cache-update-article
2362       gnus-cache-articles-in-group)
2363      ("gnus-cache" :interactive t gnus-jog-cache gnus-cache-enter-article
2364       gnus-cache-remove-article gnus-summary-insert-cached-articles)
2365      ("gnus-score" :interactive t
2366       gnus-summary-increase-score gnus-summary-set-score
2367       gnus-summary-raise-thread gnus-summary-raise-same-subject
2368       gnus-summary-raise-score gnus-summary-raise-same-subject-and-select
2369       gnus-summary-lower-thread gnus-summary-lower-same-subject
2370       gnus-summary-lower-score gnus-summary-lower-same-subject-and-select
2371       gnus-summary-current-score gnus-score-delta-default
2372       gnus-score-flush-cache gnus-score-close
2373       gnus-possibly-score-headers gnus-score-followup-article
2374       gnus-score-followup-thread)
2375      ("gnus-score"
2376       (gnus-summary-score-map keymap) gnus-score-save gnus-score-headers
2377       gnus-current-score-file-nondirectory gnus-score-adaptive
2378       gnus-score-find-trace gnus-score-file-name)
2379      ("gnus-cus" :interactive t gnus-custom-mode gnus-group-customize
2380       gnus-score-customize)
2381      ("gnus-topic" :interactive t gnus-topic-mode)
2382      ("gnus-topic" gnus-topic-remove-group gnus-topic-set-parameters
2383       gnus-subscribe-topics)
2384      ("gnus-salt" :interactive t gnus-pick-mode gnus-binary-mode)
2385      ("gnus-uu" (gnus-uu-extract-map keymap) (gnus-uu-mark-map keymap))
2386      ("gnus-uu" :interactive t
2387       gnus-uu-digest-mail-forward gnus-uu-digest-post-forward
2388       gnus-uu-mark-series gnus-uu-mark-region gnus-uu-mark-buffer
2389       gnus-uu-mark-by-regexp gnus-uu-mark-all
2390       gnus-uu-mark-sparse gnus-uu-mark-thread gnus-uu-decode-uu
2391       gnus-uu-decode-uu-and-save gnus-uu-decode-unshar
2392       gnus-uu-decode-unshar-and-save gnus-uu-decode-save
2393       gnus-uu-decode-binhex gnus-uu-decode-uu-view
2394       gnus-uu-decode-uu-and-save-view gnus-uu-decode-unshar-view
2395       gnus-uu-decode-unshar-and-save-view gnus-uu-decode-save-view
2396       gnus-uu-decode-binhex-view gnus-uu-unmark-thread
2397       gnus-uu-mark-over gnus-uu-post-news)
2398      ("gnus-uu" gnus-uu-delete-work-dir gnus-quote-arg-for-sh-or-csh
2399       gnus-uu-unmark-thread)
2400      ("gnus-msg" (gnus-summary-send-map keymap)
2401       gnus-article-mail gnus-copy-article-buffer gnus-following-method)
2402      ("gnus-msg" :interactive t
2403       gnus-group-post-news gnus-group-mail gnus-group-news
2404       gnus-summary-post-news gnus-summary-news-other-window
2405       gnus-summary-followup gnus-summary-followup-with-original
2406       gnus-summary-cancel-article gnus-summary-supersede-article
2407       gnus-post-news gnus-summary-reply gnus-summary-reply-with-original
2408       gnus-summary-mail-forward gnus-summary-mail-other-window
2409       gnus-summary-resend-message gnus-summary-resend-bounced-mail
2410       gnus-summary-wide-reply gnus-summary-followup-to-mail
2411       gnus-summary-followup-to-mail-with-original gnus-bug
2412       gnus-summary-wide-reply-with-original gnus-summary-post-forward
2413       gnus-summary-digest-mail-forward gnus-summary-digest-post-forward)
2414      ("gnus-picon" :interactive t gnus-treat-from-picon)
2415      ("gnus-gl" bbb-login bbb-logout bbb-grouplens-group-p
2416       gnus-grouplens-mode)
2417      ("smiley" :interactive t smiley-region)
2418      ("gnus-win" gnus-configure-windows gnus-add-configuration)
2419      ("gnus-sum" gnus-summary-insert-line gnus-summary-read-group
2420       gnus-list-of-unread-articles gnus-list-of-read-articles
2421       gnus-offer-save-summaries gnus-make-thread-indent-array
2422       gnus-summary-exit gnus-update-read-articles gnus-summary-last-subject
2423       gnus-summary-skip-intangible gnus-summary-article-number
2424       gnus-data-header gnus-data-find gnus-summary-jump-to-other-group)
2425      ("gnus-group" gnus-group-insert-group-line gnus-group-quit
2426       gnus-group-list-groups gnus-group-first-unread-group
2427       gnus-group-set-mode-line gnus-group-set-info gnus-group-save-newsrc
2428       gnus-group-setup-buffer gnus-group-get-new-news
2429       gnus-group-make-help-group gnus-group-update-group
2430       gnus-group-iterate gnus-group-group-name)
2431      ("gnus-bcklg" gnus-backlog-request-article gnus-backlog-enter-article
2432       gnus-backlog-remove-article)
2433      ("gnus-art" gnus-article-read-summary-keys gnus-article-save
2434       gnus-article-prepare gnus-article-set-window-start
2435       gnus-article-next-page gnus-article-prev-page
2436       gnus-request-article-this-buffer gnus-article-mode
2437       gnus-article-setup-buffer gnus-narrow-to-page
2438       gnus-article-delete-invisible-text gnus-treat-article)
2439      ("gnus-art" :interactive t
2440       gnus-article-hide-headers gnus-article-hide-boring-headers
2441       gnus-article-treat-overstrike
2442       gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
2443       gnus-article-display-x-face
2444       gnus-article-decode-HZ
2445       gnus-article-wash-html
2446       gnus-article-unsplit-urls
2447       gnus-article-hide-pgp
2448       gnus-article-hide-pem gnus-article-hide-signature
2449       gnus-article-strip-leading-blank-lines gnus-article-date-local
2450       gnus-article-date-original gnus-article-date-lapsed
2451       gnus-article-show-all-headers
2452       ;; gnus-article-show-all
2453       gnus-article-edit-mode gnus-article-edit-article
2454       gnus-article-edit-done article-decode-encoded-words
2455       gnus-start-date-timer gnus-stop-date-timer)
2456      ("gnus-int" gnus-request-type)
2457      ("gnus-start" gnus-newsrc-parse-options gnus-1 gnus-no-server-1
2458       gnus-dribble-enter gnus-read-init-file gnus-dribble-touch)
2459      ("gnus-dup" gnus-dup-suppress-articles gnus-dup-unsuppress-article
2460       gnus-dup-enter-articles)
2461      ("gnus-range" gnus-copy-sequence)
2462      ("gnus-eform" gnus-edit-form)
2463      ("gnus-move" :interactive t
2464       gnus-group-move-group-to-server gnus-change-server)
2465      ("gnus-logic" gnus-score-advanced)
2466      ("gnus-undo" gnus-undo-mode gnus-undo-register)
2467      ("gnus-async" gnus-async-request-fetched-article gnus-async-prefetch-next
2468       gnus-async-prefetch-article gnus-async-prefetch-remove-group
2469       gnus-async-halt-prefetch)
2470      ("gnus-offline"
2471       gnus-offline-setup)
2472      ("gnus-offline" :interactive t
2473       gnus-offline-toggle-plugged
2474       gnus-offline-set-unplugged-state
2475       gnus-offline-toggle-auto-hangup
2476       gnus-offline-toggle-on/off-send-mail
2477       gnus-offline-toggle-articles-to-fetch
2478       gnus-offline-set-interval-time
2479       gnus-offline-agent-expire)
2480      ("miee" :interactive t gnspool-get-news
2481       mail-spool-send news-spool-post)
2482      ("international/mw32misc" define-process-argument-editing
2483       general-process-argument-editing-function)
2484      ("gnus-agent" gnus-open-agent gnus-agent-get-function
2485       gnus-agent-save-groups gnus-agent-save-active gnus-agent-method-p
2486       gnus-agent-get-undownloaded-list gnus-agent-fetch-session
2487       gnus-summary-set-agent-mark gnus-agent-save-group-info
2488       gnus-agent-request-article gnus-agent-retrieve-headers)
2489      ("gnus-agent" :interactive t
2490       gnus-unplugged gnus-agentize gnus-agent-batch)
2491      ("gnus-vm" :interactive t gnus-summary-save-in-vm
2492       gnus-summary-save-article-vm)
2493      ("compface" uncompface)
2494      ("gnus-draft" :interactive t gnus-draft-mode gnus-group-send-queue)
2495      ("gnus-mlspl" gnus-group-split gnus-group-split-fancy)
2496      ("gnus-mlspl" :interactive t gnus-group-split-setup
2497       gnus-group-split-update)
2498      ("gnus-delay" gnus-delay-initialize))))
2499
2500 (eval-and-compile
2501   (unless (featurep 'xemacs)
2502     (if (>= emacs-major-version 21)
2503         (autoload 'x-face-decode-message-header "x-face-e21")
2504       (autoload 'x-face-mule-gnus-article-display-x-face "x-face-mule"))))
2505
2506 (unless (and (fboundp 'base64-encode-string)
2507              (subrp (symbol-function 'base64-encode-string)))
2508   (require 'base64))
2509
2510 ;; To search articles with Namazu.
2511 (autoload 'gnus-namazu-search "gnus-namazu" nil t)
2512 (autoload 'gnus-namazu-create-index "gnus-namazu" nil t)
2513 (autoload 'gnus-namazu-update-index "gnus-namazu" nil t)
2514 (autoload 'gnus-namazu-update-all-indices "gnus-namazu" nil t)
2515
2516 ;; To make nnir groups.
2517 (autoload 'gnus-group-make-nnir-group "nnir" nil t)
2518
2519 ;; To make shimbun groups.
2520 (autoload 'gnus-group-make-shimbun-group "nnshimbun" nil t)
2521
2522 ;; A tool for the developers.
2523 (autoload 'find-cl-run-time-functions "gnus-clfns" nil t)
2524
2525 ;;; gnus-sum.el thingies
2526
2527
2528 (defcustom gnus-summary-line-format "%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n"
2529   "*The format specification of the lines in the summary buffer.
2530
2531 It works along the same lines as a normal formatting string,
2532 with some simple extensions.
2533
2534 %N   Article number, left padded with spaces (string)
2535 %S   Subject (string)
2536 %s   Subject if it is at the root of a thread, and \"\" otherwise (string)
2537 %n   Name of the poster (string)
2538 %a   Extracted name of the poster (string)
2539 %A   Extracted address of the poster (string)
2540 %F   Contents of the From: header (string)
2541 %f   Contents of the From: or To: headers (string)
2542 %x   Contents of the Xref: header (string)
2543 %D   Date of the article (string)
2544 %d   Date of the article (string) in DD-MMM format
2545 %o   Date of the article (string) in YYYYMMDD`T'HHMMSS format
2546 %M   Message-id of the article (string)
2547 %r   References of the article (string)
2548 %c   Number of characters in the article (integer)
2549 %k   Pretty-printed version of the above (string)
2550      For example, \"1.2k\" or \"0.4M\".
2551 %L   Number of lines in the article (integer)
2552 %I   Indentation based on thread level (a string of spaces)
2553 %B   A complex trn-style thread tree (string)
2554      The variables `gnus-sum-thread-*' can be used for customization.
2555 %T   A string with two possible values: 80 spaces if the article
2556      is on thread level two or larger and 0 spaces on level one
2557 %R   \"A\" if this article has been replied to, \" \" otherwise (character)
2558 %U   Status of this article (character, \"R\", \"K\", \"-\" or \" \")
2559 %[   Opening bracket (character, \"[\" or \"<\")
2560 %]   Closing bracket (character, \"]\" or \">\")
2561 %>   Spaces of length thread-level (string)
2562 %<   Spaces of length (- 20 thread-level) (string)
2563 %i   Article score (number)
2564 %z   Article zcore (character)
2565 %t   Number of articles under the current thread (number).
2566 %e   Whether the thread is empty or not (character).
2567 %l   GroupLens score (string).
2568 %V   Total thread score (number).
2569 %P   The line number (number).
2570 %O   Download mark (character).
2571 %C   If present, indicates desired cursor position
2572      (instead of after first colon).
2573 %u   User defined specifier.  The next character in the format string should
2574      be a letter.  Gnus will call the function gnus-user-format-function-X,
2575      where X is the letter following %u.  The function will be passed the
2576      current header as argument.  The function should return a string, which
2577      will be inserted into the summary just like information from any other
2578      summary specifier.
2579
2580 The %U (status), %R (replied) and %z (zcore) specs have to be handled
2581 with care.  For reasons of efficiency, Gnus will compute what column
2582 these characters will end up in, and \"hard-code\" that.  This means that
2583 it is invalid to have these specs after a variable-length spec.  Well,
2584 you might not be arrested, but your summary buffer will look strange,
2585 which is bad enough.
2586
2587 The smart choice is to have these specs as far to the left as
2588 possible.
2589
2590 This restriction may disappear in later versions of Gnus.
2591
2592 General format specifiers can also be used.
2593 See Info node `(gnus)Formatting Variables'."
2594   :link '(custom-manual "(gnus)Formatting Variables")
2595   :type 'string
2596   :group 'gnus-summary-format)
2597
2598 ;;;
2599 ;;; Skeleton keymaps
2600 ;;;
2601
2602 (defun gnus-suppress-keymap (keymap)
2603   (suppress-keymap keymap)
2604   (let ((keys `([backspace] [delete] "\177" "\M-u"))) ;gnus-mouse-2
2605     (while keys
2606       (define-key keymap (pop keys) 'undefined))))
2607
2608 (defvar gnus-article-mode-map
2609   (let ((keymap (make-sparse-keymap)))
2610     (gnus-suppress-keymap keymap)
2611     keymap))
2612 (defvar gnus-summary-mode-map
2613   (let ((keymap (make-keymap)))
2614     (gnus-suppress-keymap keymap)
2615     keymap))
2616 (defvar gnus-group-mode-map
2617   (let ((keymap (make-keymap)))
2618     (gnus-suppress-keymap keymap)
2619     keymap))
2620
2621 \f
2622
2623 ;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
2624 ;; If you want the cursor to go somewhere else, set these two
2625 ;; functions in some startup hook to whatever you want.
2626 (defalias 'gnus-summary-position-point 'gnus-goto-colon)
2627 (defalias 'gnus-group-position-point 'gnus-goto-colon)
2628
2629 ;;; Various macros and substs.
2630
2631 (defun gnus-header-from (header)
2632   (mail-header-from header))
2633
2634 (defmacro gnus-gethash (string hashtable)
2635   "Get hash value of STRING in HASHTABLE."
2636   `(symbol-value (intern-soft ,string ,hashtable)))
2637
2638 (defmacro gnus-gethash-safe (string hashtable)
2639   "Get hash value of STRING in HASHTABLE.
2640 Return nil if not defined."
2641   `(let ((sym (intern-soft ,string ,hashtable)))
2642      (and (boundp sym) (symbol-value sym))))
2643
2644 (defmacro gnus-sethash (string value hashtable)
2645   "Set hash value.  Arguments are STRING, VALUE, and HASHTABLE."
2646   `(set (intern ,string ,hashtable) ,value))
2647 (put 'gnus-sethash 'edebug-form-spec '(form form form))
2648
2649 (defmacro gnus-group-unread (group)
2650   "Get the currently computed number of unread articles in GROUP."
2651   `(car (gnus-gethash ,group gnus-newsrc-hashtb)))
2652
2653 (defmacro gnus-group-entry (group)
2654   "Get the newsrc entry for GROUP."
2655   `(gnus-gethash ,group gnus-newsrc-hashtb))
2656
2657 (defmacro gnus-active (group)
2658   "Get active info on GROUP."
2659   `(gnus-gethash ,group gnus-active-hashtb))
2660
2661 (defmacro gnus-set-active (group active)
2662   "Set GROUP's active info."
2663   `(gnus-sethash ,group ,active gnus-active-hashtb))
2664
2665 ;; Info access macros.
2666
2667 (defmacro gnus-info-group (info)
2668   `(nth 0 ,info))
2669 (defmacro gnus-info-rank (info)
2670   `(nth 1 ,info))
2671 (defmacro gnus-info-read (info)
2672   `(nth 2 ,info))
2673 (defmacro gnus-info-marks (info)
2674   `(nth 3 ,info))
2675 (defmacro gnus-info-method (info)
2676   `(nth 4 ,info))
2677 (defmacro gnus-info-params (info)
2678   `(nth 5 ,info))
2679
2680 (defmacro gnus-info-level (info)
2681   `(let ((rank (gnus-info-rank ,info)))
2682      (if (consp rank)
2683          (car rank)
2684        rank)))
2685 (defmacro gnus-info-score (info)
2686   `(let ((rank (gnus-info-rank ,info)))
2687      (or (and (consp rank) (cdr rank)) 0)))
2688
2689 (defmacro gnus-info-set-group (info group)
2690   `(setcar ,info ,group))
2691 (defmacro gnus-info-set-rank (info rank)
2692   `(setcar (nthcdr 1 ,info) ,rank))
2693 (defmacro gnus-info-set-read (info read)
2694   `(setcar (nthcdr 2 ,info) ,read))
2695 (defmacro gnus-info-set-marks (info marks &optional extend)
2696   (if extend
2697       `(gnus-info-set-entry ,info ,marks 3)
2698     `(setcar (nthcdr 3 ,info) ,marks)))
2699 (defmacro gnus-info-set-method (info method &optional extend)
2700   (if extend
2701       `(gnus-info-set-entry ,info ,method 4)
2702     `(setcar (nthcdr 4 ,info) ,method)))
2703 (defmacro gnus-info-set-params (info params &optional extend)
2704   (if extend
2705       `(gnus-info-set-entry ,info ,params 5)
2706     `(setcar (nthcdr 5 ,info) ,params)))
2707
2708 (defun gnus-info-set-entry (info entry number)
2709   ;; Extend the info until we have enough elements.
2710   (while (<= (length info) number)
2711     (nconc info (list nil)))
2712   ;; Set the entry.
2713   (setcar (nthcdr number info) entry))
2714
2715 (defmacro gnus-info-set-level (info level)
2716   `(let ((rank (cdr ,info)))
2717      (if (consp (car rank))
2718          (setcar (car rank) ,level)
2719        (setcar rank ,level))))
2720 (defmacro gnus-info-set-score (info score)
2721   `(let ((rank (cdr ,info)))
2722      (if (consp (car rank))
2723          (setcdr (car rank) ,score)
2724        (setcar rank (cons (car rank) ,score)))))
2725
2726 (defmacro gnus-get-info (group)
2727   `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
2728
2729 ;;; Load the compatibility functions.
2730
2731 (require 'gnus-ems)
2732
2733 \f
2734 ;;;
2735 ;;; Shutdown
2736 ;;;
2737
2738 (defvar gnus-shutdown-alist nil)
2739
2740 (defun gnus-add-shutdown (function &rest symbols)
2741   "Run FUNCTION whenever one of SYMBOLS is shut down."
2742   (push (cons function symbols) gnus-shutdown-alist))
2743
2744 (defun gnus-shutdown (symbol)
2745   "Shut down everything that waits for SYMBOL."
2746   (let ((alist gnus-shutdown-alist)
2747         entry)
2748     (while (setq entry (pop alist))
2749       (when (memq symbol (cdr entry))
2750         (funcall (car entry))))))
2751
2752 \f
2753 ;;;
2754 ;;; Gnus Utility Functions
2755 ;;;
2756
2757 (defun gnus-find-subscribed-addresses ()
2758   "Return a regexp matching the addresses of all subscribed mail groups.
2759 It consists of the `to-address' or `to-list' parameter of all groups
2760 with a `subscribed' parameter."
2761   (let (group address addresses)
2762     (dolist (entry (cdr gnus-newsrc-alist))
2763       (setq group (car entry))
2764       (when (gnus-parameter-subscribed group)
2765         (setq address (mail-strip-quoted-names
2766                        (or (gnus-group-fast-parameter group 'to-address)
2767                            (gnus-group-fast-parameter group 'to-list))))
2768         (when address
2769           (add-to-list 'addresses address))))
2770     (when addresses
2771       (list (mapconcat 'regexp-quote addresses "\\|")))))
2772
2773 (defmacro gnus-string-or (&rest strings)
2774   "Return the first element of STRINGS that is a non-blank string.
2775 STRINGS will be evaluated in normal `or' order."
2776   `(gnus-string-or-1 ',strings))
2777
2778 (defun gnus-string-or-1 (strings)
2779   (let (string)
2780     (while strings
2781       (setq string (eval (pop strings)))
2782       (if (string-match "^[ \t]*$" string)
2783           (setq string nil)
2784         (setq strings nil)))
2785     string))
2786
2787 (defun gnus-info-find-node (&optional nodename)
2788   "Find Info documentation of Gnus."
2789   (interactive)
2790   ;; Enlarge info window if needed.
2791   (let (gnus-info-buffer)
2792     (Info-goto-node
2793      (format "(%s)%s"
2794              (or gnus-info-filename
2795                  (get-language-info current-language-environment 'gnus-info)
2796                  "gnus")
2797              (or nodename
2798                  (cadr (assq major-mode gnus-info-nodes))
2799                  (and (eq (current-buffer) (get-buffer gnus-article-buffer))
2800                       (cadr (assq 'gnus-article-mode gnus-info-nodes))))))
2801     (setq gnus-info-buffer (current-buffer))
2802     (gnus-configure-windows 'info)))
2803
2804 ;;;
2805 ;;; gnus-interactive
2806 ;;;
2807
2808 (defvar gnus-current-prefix-symbol nil
2809   "Current prefix symbol.")
2810
2811 (defvar gnus-current-prefix-symbols nil
2812   "List of current prefix symbols.")
2813
2814 (defun gnus-interactive (string &optional params)
2815   "Return a list that can be fed to `interactive'.
2816 See `interactive' for full documentation.
2817
2818 Adds the following specs:
2819
2820 y -- The current symbolic prefix.
2821 Y -- A list of the current symbolic prefix(es).
2822 A -- Article number.
2823 H -- Article header.
2824 g -- Group name."
2825   (let ((i 0)
2826         out c prompt)
2827     (while (< i (length string))
2828       (string-match ".\\([^\n]*\\)\n?" string i)
2829       (setq c (aref string i))
2830       (when (match-end 1)
2831         (setq prompt (match-string 1 string)))
2832       (setq i (match-end 0))
2833       ;; We basically emulate just about everything that
2834       ;; `interactive' does, but add the specs listed above.
2835       (push
2836        (cond
2837         ((= c ?a)
2838          (completing-read prompt obarray 'fboundp t))
2839         ((= c ?b)
2840          (read-buffer prompt (current-buffer) t))
2841         ((= c ?B)
2842          (read-buffer prompt (other-buffer (current-buffer))))
2843         ((= c ?c)
2844          (read-char))
2845         ((= c ?C)
2846          (completing-read prompt obarray 'commandp t))
2847         ((= c ?d)
2848          (point))
2849         ((= c ?D)
2850          (read-file-name prompt nil default-directory 'lambda))
2851         ((= c ?f)
2852          (read-file-name prompt nil nil 'lambda))
2853         ((= c ?F)
2854          (read-file-name prompt))
2855         ((= c ?k)
2856          (read-key-sequence prompt))
2857         ((= c ?K)
2858          (error "Not implemented spec"))
2859         ((= c ?e)
2860          (error "Not implemented spec"))
2861         ((= c ?m)
2862          (mark))
2863         ((= c ?N)
2864          (error "Not implemented spec"))
2865         ((= c ?n)
2866          (string-to-number (read-from-minibuffer prompt)))
2867         ((= c ?p)
2868          (prefix-numeric-value current-prefix-arg))
2869         ((= c ?P)
2870          current-prefix-arg)
2871         ((= c ?r)
2872          'gnus-prefix-nil)
2873         ((= c ?s)
2874          (read-string prompt))
2875         ((= c ?S)
2876          (intern (read-string prompt)))
2877         ((= c ?v)
2878          (read-variable prompt))
2879         ((= c ?x)
2880          (read-minibuffer prompt))
2881         ((= c ?x)
2882          (eval-minibuffer prompt))
2883         ;; And here the new specs come.
2884         ((= c ?y)
2885          gnus-current-prefix-symbol)
2886         ((= c ?Y)
2887          gnus-current-prefix-symbols)
2888         ((= c ?g)
2889          (gnus-group-group-name))
2890         ((= c ?A)
2891          (gnus-summary-skip-intangible)
2892          (or (get-text-property (point) 'gnus-number)
2893              (gnus-summary-last-subject)))
2894         ((= c ?H)
2895          (gnus-data-header (gnus-data-find (gnus-summary-article-number))))
2896         (t
2897          (error "Non-implemented spec")))
2898        out)
2899       (cond
2900        ((= c ?r)
2901         (push (if (< (point) (mark)) (point) (mark)) out)
2902         (push (if (> (point) (mark)) (point) (mark)) out))))
2903     (setq out (delq 'gnus-prefix-nil out))
2904     (nreverse out)))
2905
2906 (defun gnus-symbolic-argument (&optional arg)
2907   "Read a symbolic argument and a command, and then execute command."
2908   (interactive "P")
2909   (let* ((in-command (this-command-keys))
2910          (command in-command)
2911          gnus-current-prefix-symbols
2912          gnus-current-prefix-symbol
2913          syms)
2914     (while (equal in-command command)
2915       (message "%s-" (key-description (this-command-keys)))
2916       (push (intern (char-to-string (read-char))) syms)
2917       (setq command (read-key-sequence nil t)))
2918     (setq gnus-current-prefix-symbols (nreverse syms)
2919           gnus-current-prefix-symbol (car gnus-current-prefix-symbols))
2920     (call-interactively (key-binding command t))))
2921
2922 ;;; More various functions.
2923
2924 (defsubst gnus-check-backend-function (func group)
2925   "Check whether GROUP supports function FUNC.
2926 GROUP can either be a string (a group name) or a select method."
2927   (ignore-errors
2928     (let ((method (if (stringp group)
2929                       (car (gnus-find-method-for-group group))
2930                     group)))
2931       (unless (featurep method)
2932         (require method))
2933       (fboundp (intern (format "%s-%s" method func))))))
2934
2935 (defun gnus-group-read-only-p (&optional group)
2936   "Check whether GROUP supports editing or not.
2937 If GROUP is nil, `gnus-newsgroup-name' will be checked instead.  Note
2938 that that variable is buffer-local to the summary buffers."
2939   (let ((group (or group gnus-newsgroup-name)))
2940     (not (gnus-check-backend-function 'request-replace-article group))))
2941
2942 (defun gnus-virtual-group-p (group)
2943   "Say whether GROUP is virtual or not."
2944   (memq 'virtual (assoc (symbol-name (car (gnus-find-method-for-group group)))
2945                         gnus-valid-select-methods)))
2946
2947 (defun gnus-news-group-p (group &optional article)
2948   "Return non-nil if GROUP (and ARTICLE) come from a news server."
2949   (cond ((gnus-member-of-valid 'post group) ;Ordinary news group
2950          t)                             ;is news of course.
2951         ((not (gnus-member-of-valid 'post-mail group)) ;Non-combined.
2952          nil)                           ;must be mail then.
2953         ((vectorp article)              ;Has header info.
2954          (eq (gnus-request-type group (mail-header-id article)) 'news))
2955         ((null article)                 ;Hasn't header info
2956          (eq (gnus-request-type group) 'news)) ;(unknown ==> mail)
2957         ((< article 0)                  ;Virtual message
2958          nil)                           ;we don't know, guess mail.
2959         (t                              ;Has positive number
2960          (eq (gnus-request-type group article) 'news)))) ;use it.
2961
2962 ;; Returns a list of writable groups.
2963 (defun gnus-writable-groups ()
2964   (let ((alist gnus-newsrc-alist)
2965         groups group)
2966     (while (setq group (car (pop alist)))
2967       (unless (gnus-group-read-only-p group)
2968         (push group groups)))
2969     (nreverse groups)))
2970
2971 ;; Check whether to use long file names.
2972 (defun gnus-use-long-file-name (symbol)
2973   ;; The variable has to be set...
2974   (and gnus-use-long-file-name
2975        ;; If it isn't a list, then we return t.
2976        (or (not (listp gnus-use-long-file-name))
2977            ;; If it is a list, and the list contains `symbol', we
2978            ;; return nil.
2979            (not (memq symbol gnus-use-long-file-name)))))
2980
2981 ;; Generate a unique new group name.
2982 (defun gnus-generate-new-group-name (leaf)
2983   (let ((name leaf)
2984         (num 0))
2985     (while (gnus-gethash name gnus-newsrc-hashtb)
2986       (setq name (concat leaf "<" (int-to-string (setq num (1+ num))) ">")))
2987     name))
2988
2989 (defun gnus-ephemeral-group-p (group)
2990   "Say whether GROUP is ephemeral or not."
2991   (gnus-group-get-parameter group 'quit-config t))
2992
2993 (defun gnus-group-quit-config (group)
2994   "Return the quit-config of GROUP."
2995   (gnus-group-get-parameter group 'quit-config t))
2996
2997 (defun gnus-kill-ephemeral-group (group)
2998   "Remove ephemeral GROUP from relevant structures."
2999   (gnus-sethash group nil gnus-newsrc-hashtb))
3000
3001 (defun gnus-simplify-mode-line ()
3002   "Make mode lines a bit simpler."
3003   (setq mode-line-modified (cdr gnus-mode-line-modified))
3004   (when (listp mode-line-format)
3005     (make-local-variable 'mode-line-format)
3006     (setq mode-line-format (copy-sequence mode-line-format))
3007     (when (equal (nth 3 mode-line-format) "   ")
3008       (setcar (nthcdr 3 mode-line-format) " "))))
3009
3010 ;;; Servers and groups.
3011
3012 (defsubst gnus-server-add-address (method)
3013   (let ((method-name (symbol-name (car method))))
3014     (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
3015              (not (assq (intern (concat method-name "-address")) method))
3016              (memq 'physical-address (assq (car method)
3017                                            gnus-valid-select-methods)))
3018         (append method (list (list (intern (concat method-name "-address"))
3019                                    (nth 1 method))))
3020       method)))
3021
3022 (defsubst gnus-server-to-method (server)
3023   "Map virtual server names to select methods."
3024   (or (and server (listp server) server)
3025       (cdr (assoc server gnus-server-method-cache))
3026       (let ((result
3027              (or
3028               ;; Perhaps this is the native server?
3029               (and (equal server "native") gnus-select-method)
3030               ;; It should be in the server alist.
3031               (cdr (assoc server gnus-server-alist))
3032               ;; It could be in the predefined server alist.
3033               (cdr (assoc server gnus-predefined-server-alist))
3034               ;; If not, we look through all the opened server
3035               ;; to see whether we can find it there.
3036               (let ((opened gnus-opened-servers))
3037                 (while (and opened
3038                             (not (equal server (format "%s:%s" (caaar opened)
3039                                                        (cadaar opened)))))
3040                   (pop opened))
3041                 (caar opened))
3042               ;; It could be a named method, search all servers
3043               (let ((servers gnus-secondary-select-methods))
3044                 (while (and servers
3045                             (not (equal server (format "%s:%s" (caar servers)
3046                                                        (cadar servers)))))
3047                   (pop servers))
3048                 (car servers)))))
3049         (push (cons server result) gnus-server-method-cache)
3050         result)))
3051
3052 (defsubst gnus-server-get-method (group method)
3053   ;; Input either a server name, and extended server name, or a
3054   ;; select method, and return a select method.
3055   (cond ((stringp method)
3056          (gnus-server-to-method method))
3057         ((equal method gnus-select-method)
3058          gnus-select-method)
3059         ((and (stringp (car method))
3060               group)
3061          (gnus-server-extend-method group method))
3062         ((and method
3063               (not group)
3064               (equal (cadr method) ""))
3065          method)
3066         (t
3067          (gnus-server-add-address method))))
3068
3069 (defmacro gnus-method-equal (ss1 ss2)
3070   "Say whether two servers are equal."
3071   `(let ((s1 ,ss1)
3072          (s2 ,ss2))
3073      (or (equal s1 s2)
3074          (and (= (length s1) (length s2))
3075               (progn
3076                 (while (and s1 (member (car s1) s2))
3077                   (setq s1 (cdr s1)))
3078                 (null s1))))))
3079
3080 (defun gnus-methods-equal-p (m1 m2)
3081   (let ((m1 (or m1 gnus-select-method))
3082         (m2 (or m2 gnus-select-method)))
3083     (or (equal m1 m2)
3084         (and (eq (car m1) (car m2))
3085              (or (not (memq 'address (assoc (symbol-name (car m1))
3086                                             gnus-valid-select-methods)))
3087                  (equal (nth 1 m1) (nth 1 m2)))))))
3088
3089 (defun gnus-server-equal (m1 m2)
3090   "Say whether two methods are equal."
3091   (let ((m1 (cond ((null m1) gnus-select-method)
3092                   ((stringp m1) (gnus-server-to-method m1))
3093                   (t m1)))
3094         (m2 (cond ((null m2) gnus-select-method)
3095                   ((stringp m2) (gnus-server-to-method m2))
3096                   (t m2))))
3097     (gnus-method-equal m1 m2)))
3098
3099 (defun gnus-servers-using-backend (backend)
3100   "Return a list of known servers using BACKEND."
3101   (let ((opened gnus-opened-servers)
3102         out)
3103     (while opened
3104       (when (eq backend (caaar opened))
3105         (push (caar opened) out))
3106       (pop opened))
3107     out))
3108
3109 (defun gnus-archive-server-wanted-p ()
3110   "Say whether the user wants to use the archive server."
3111   (cond
3112    ((or (not gnus-message-archive-method)
3113         (not gnus-message-archive-group))
3114     nil)
3115    ((and gnus-message-archive-method gnus-message-archive-group)
3116     t)
3117    (t
3118     (let ((active (cadr (assq 'nnfolder-active-file
3119                               gnus-message-archive-method))))
3120       (and active
3121            (file-exists-p active))))))
3122
3123 (defsubst gnus-method-to-server-name (method)
3124   (concat
3125    (format "%s" (car method))
3126    (when (and
3127           (or (assoc (format "%s" (car method))
3128                      (gnus-methods-using 'address))
3129               (gnus-server-equal method gnus-message-archive-method))
3130           (nth 1 method)
3131           (not (string= (nth 1 method) "")))
3132      (concat "+" (nth 1 method)))))
3133
3134 (defsubst gnus-method-to-full-server-name (method)
3135   (format "%s+%s" (car method) (nth 1 method)))
3136
3137 (defun gnus-group-prefixed-name (group method)
3138   "Return the whole name from GROUP and METHOD."
3139   (and (stringp method) (setq method (gnus-server-to-method method)))
3140   (if (or (not method)
3141           (gnus-server-equal method "native")
3142           (string-match ":" group))
3143       group
3144     (concat (gnus-method-to-server-name method) ":" group)))
3145
3146 (defun gnus-group-real-prefix (group)
3147   "Return the prefix of the current group name."
3148   (if (string-match "^[^:]+:" group)
3149       (substring group 0 (match-end 0))
3150     ""))
3151
3152 (defun gnus-group-method (group)
3153   "Return the server or method used for selecting GROUP.
3154 You should probably use `gnus-find-method-for-group' instead."
3155   (let ((prefix (gnus-group-real-prefix group)))
3156     (if (equal prefix "")
3157         gnus-select-method
3158       (let ((servers gnus-opened-servers)
3159             (server "")
3160             backend possible found)
3161         (if (string-match "^[^\\+]+\\+" prefix)
3162             (setq backend (intern (substring prefix 0 (1- (match-end 0))))
3163                   server (substring prefix (match-end 0) (1- (length prefix))))
3164           (setq backend (intern (substring prefix 0 (1- (length prefix))))))
3165         (while servers
3166           (when (eq (caaar servers) backend)
3167             (setq possible (caar servers))
3168             (when (equal (cadaar servers) server)
3169               (setq found (caar servers))))
3170           (pop servers))
3171         (or (car (rassoc found gnus-server-alist))
3172             found
3173             (car (rassoc possible gnus-server-alist))
3174             possible
3175             (list backend server))))))
3176
3177 (defsubst gnus-native-method-p (method)
3178   "Return whether METHOD is the native select method."
3179   (gnus-method-equal method gnus-select-method))
3180
3181 (defsubst gnus-secondary-method-p (method)
3182   "Return whether METHOD is a secondary select method."
3183   (let ((methods gnus-secondary-select-methods)
3184         (gmethod (gnus-server-get-method nil method)))
3185     (while (and methods
3186                 (not (gnus-method-equal
3187                       (gnus-server-get-method nil (car methods))
3188                       gmethod)))
3189       (setq methods (cdr methods)))
3190     methods))
3191
3192 (defun gnus-method-simplify (method)
3193   "Return the shortest uniquely identifying string or method for METHOD."
3194   (cond ((stringp method)
3195          method)
3196         ((gnus-native-method-p method)
3197          nil)
3198         ((gnus-secondary-method-p method)
3199          (format "%s:%s" (nth 0 method) (nth 1 method)))
3200         (t
3201          method)))
3202
3203 (defun gnus-groups-from-server (server)
3204   "Return a list of all groups that are fetched from SERVER."
3205   (let ((alist (cdr gnus-newsrc-alist))
3206         info groups)
3207     (while (setq info (pop alist))
3208       (when (gnus-server-equal (gnus-info-method info) server)
3209         (push (gnus-info-group info) groups)))
3210     (sort groups 'string<)))
3211
3212 (defun gnus-group-foreign-p (group)
3213   "Say whether a group is foreign or not."
3214   (and (not (gnus-group-native-p group))
3215        (not (gnus-group-secondary-p group))))
3216
3217 (defun gnus-group-native-p (group)
3218   "Say whether the group is native or not."
3219   (not (string-match ":" group)))
3220
3221 (defun gnus-group-secondary-p (group)
3222   "Say whether the group is secondary or not."
3223   (gnus-secondary-method-p (gnus-find-method-for-group group)))
3224
3225 (defun gnus-parameters-get-parameter (group)
3226   "Return the group parameters for GROUP from `gnus-parameters'."
3227   (let (params-list)
3228     (dolist (elem gnus-parameters)
3229       (when (string-match (car elem) group)
3230         (setq params-list
3231               (nconc (gnus-expand-group-parameters
3232                       (car elem) (cdr elem) group)
3233                      params-list))))
3234     params-list))
3235
3236 (defun gnus-expand-group-parameter (match value group)
3237   "Use MATCH to expand VALUE in GROUP."
3238   (with-temp-buffer
3239     (insert group)
3240     (goto-char (point-min))
3241     (while (re-search-forward match nil t)
3242       (replace-match value))
3243     (buffer-string)))
3244
3245 (defun gnus-expand-group-parameters (match parameters group)
3246   "Go through PARAMETERS and expand them according to the match data."
3247   (let (new)
3248     (dolist (elem parameters)
3249       (if (and (stringp (cdr elem))
3250                (string-match "\\\\[0-9&]" (cdr elem)))
3251           (push (cons (car elem)
3252                       (gnus-expand-group-parameter match (cdr elem) group))
3253                 new)
3254         (push elem new)))
3255     new))
3256
3257 (defun gnus-group-fast-parameter (group symbol &optional allow-list)
3258   "For GROUP, return the value of SYMBOL.
3259
3260 You should call this in the `gnus-group-buffer' buffer.
3261 The function `gnus-group-find-parameter' will do that for you."
3262   ;; The speed trick:  No cons'ing and quit early.
3263   (let* ((params (funcall gnus-group-get-parameter-function group))
3264          ;; Start easy, check the "real" group parameters.
3265          (simple-results
3266           (gnus-group-parameter-value params symbol allow-list t)))
3267     (if simple-results
3268         ;; Found results; return them.
3269         (car simple-results)
3270       ;; We didn't found it there, try `gnus-parameters'.
3271       (let ((result nil)
3272             (head nil)
3273             (tail gnus-parameters))
3274         ;; A good old-fashioned non-cl loop.
3275         (while tail
3276           (setq head (car tail)
3277                 tail (cdr tail))
3278           ;; The car is regexp matching for matching the group name.
3279           (when (string-match (car head) group)
3280             ;; The cdr is the parameters.
3281             (setq result (gnus-group-parameter-value (cdr head)
3282                                                      symbol allow-list))
3283             (when result
3284               ;; Expand if necessary.
3285               (if (and (stringp result) (string-match "\\\\[0-9&]" result))
3286                   (setq result (gnus-expand-group-parameter (car head)
3287                                                             result group)))
3288               ;; Exit the loop early.
3289               (setq tail nil))))
3290         ;; Done.
3291         result))))
3292
3293 (defun gnus-group-find-parameter (group &optional symbol allow-list)
3294   "Return the group parameters for GROUP.
3295 If SYMBOL, return the value of that symbol in the group parameters.
3296
3297 If you call this function inside a loop, consider using the faster
3298 `gnus-group-fast-parameter' instead."
3299   (save-excursion
3300     (set-buffer gnus-group-buffer)
3301     (if symbol
3302         (gnus-group-fast-parameter group symbol allow-list)
3303       (nconc
3304        (copy-sequence
3305         (funcall gnus-group-get-parameter-function group))
3306        (gnus-parameters-get-parameter group)))))
3307
3308 (defun gnus-group-get-parameter (group &optional symbol allow-list)
3309   "Return the group parameters for GROUP.
3310 If SYMBOL, return the value of that symbol in the group parameters.
3311 Most functions should use `gnus-group-find-parameter', which
3312 also examines the topic parameters."
3313   (let ((params (gnus-info-params (gnus-get-info group))))
3314     (if symbol
3315         (gnus-group-parameter-value params symbol allow-list)
3316       params)))
3317
3318 (defun gnus-group-parameter-value (params symbol &optional
3319                                           allow-list present-p)
3320   "Return the value of SYMBOL in group PARAMS."
3321   ;; We only wish to return group parameters (dotted lists) and
3322   ;; not local variables, which may have the same names.
3323   ;; But first we handle single elements...
3324   (or (car (memq symbol params))
3325       ;; Handle alist.
3326       (let (elem)
3327         (catch 'found
3328           (while (setq elem (pop params))
3329             (when (and (consp elem)
3330                        (eq (car elem) symbol)
3331                        (or allow-list
3332                            (atom (cdr elem))))
3333               (throw 'found (if present-p (list (cdr elem))
3334                               (cdr elem)))))))))
3335
3336 (defun gnus-group-add-parameter (group param)
3337   "Add parameter PARAM to GROUP."
3338   (let ((info (gnus-get-info group)))
3339     (when info
3340       (gnus-group-remove-parameter group (if (consp param) (car param) param))
3341       ;; Cons the new param to the old one and update.
3342       (gnus-group-set-info (cons param (gnus-info-params info))
3343                            group 'params))))
3344
3345 (defun gnus-group-set-parameter (group name value)
3346   "Set parameter NAME to VALUE in GROUP."
3347   (let ((info (gnus-get-info group)))
3348     (when info
3349       (gnus-group-remove-parameter group name)
3350       (let ((old-params (gnus-info-params info))
3351             (new-params (list (cons name value))))
3352         (while old-params
3353           (when (or (not (listp (car old-params)))
3354                     (not (eq (caar old-params) name)))
3355             (setq new-params (append new-params (list (car old-params)))))
3356           (setq old-params (cdr old-params)))
3357         (gnus-group-set-info new-params group 'params)))))
3358
3359 (defun gnus-group-remove-parameter (group name)
3360   "Remove parameter NAME from GROUP."
3361   (let ((info (gnus-get-info group)))
3362     (when info
3363       (let ((params (gnus-info-params info)))
3364         (when params
3365           (setq params (delq name params))
3366           (while (assq name params)
3367             (gnus-pull name params))
3368           (gnus-info-set-params info params))))))
3369
3370 (defun gnus-group-add-score (group &optional score)
3371   "Add SCORE to the GROUP score.
3372 If SCORE is nil, add 1 to the score of GROUP."
3373   (let ((info (gnus-get-info group)))
3374     (when info
3375       (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
3376
3377 (defun gnus-short-group-name (group &optional levels)
3378   "Collapse GROUP name LEVELS.
3379 Select methods are stripped and any remote host name is stripped down to
3380 just the host name."
3381   (let* ((name "")
3382          (foreign "")
3383          (depth 0)
3384          (skip 1)
3385          (levels (or levels
3386                      gnus-group-uncollapsed-levels
3387                      (progn
3388                        (while (string-match "\\." group skip)
3389                          (setq skip (match-end 0)
3390                                depth (+ depth 1)))
3391                        depth))))
3392     ;; Separate foreign select method from group name and collapse.
3393     ;; If method contains a server, collapse to non-domain server name,
3394     ;; otherwise collapse to select method.
3395     (let* ((colon (string-match ":" group))
3396            (server (and colon (substring group 0 colon)))
3397            (plus (and server (string-match "+" server))))
3398       (when server
3399         (if plus
3400             (setq foreign (substring server (+ 1 plus)
3401                                      (string-match "\\." server))
3402                   group (substring group (+ 1 colon)))
3403           (setq foreign server
3404                 group (substring group (+ 1 colon))))
3405         (setq foreign (concat foreign ":")))
3406       ;; Collapse group name leaving LEVELS uncollapsed elements
3407       (let* ((slist (split-string group "/"))
3408              (slen (length slist))
3409              (dlist (split-string group "\\."))
3410              (dlen (length dlist))
3411              glist
3412              glen
3413              gsep
3414              res)
3415         (if (> slen dlen)
3416             (setq glist slist
3417                   glen slen
3418                   gsep "/")
3419           (setq glist dlist
3420                 glen dlen
3421                 gsep "."))
3422         (setq levels (- glen levels))
3423         (dolist (g glist)
3424           (push (if (>= (decf levels) 0)
3425                     (if (zerop (length g))
3426                         ""
3427                       (substring g 0 1))
3428                   g)
3429                 res))
3430         (concat foreign (mapconcat 'identity (nreverse res) gsep))))))
3431
3432 (defun gnus-narrow-to-body ()
3433   "Narrow to the body of an article."
3434   (narrow-to-region
3435    (progn
3436      (goto-char (point-min))
3437      (or (search-forward "\n\n" nil t)
3438          (point-max)))
3439    (point-max)))
3440
3441 \f
3442 ;;;
3443 ;;; Kill file handling.
3444 ;;;
3445
3446 (defun gnus-apply-kill-file ()
3447   "Apply a kill file to the current newsgroup.
3448 Returns the number of articles marked as read."
3449   (if (or (file-exists-p (gnus-newsgroup-kill-file nil))
3450           (file-exists-p (gnus-newsgroup-kill-file gnus-newsgroup-name)))
3451       (gnus-apply-kill-file-internal)
3452     0))
3453
3454 (defun gnus-kill-save-kill-buffer ()
3455   (let ((file (gnus-newsgroup-kill-file gnus-newsgroup-name)))
3456     (when (get-file-buffer file)
3457       (save-excursion
3458         (set-buffer (get-file-buffer file))
3459         (when (buffer-modified-p)
3460           (save-buffer))
3461         (kill-buffer (current-buffer))))))
3462
3463 (defcustom gnus-kill-file-name "KILL"
3464   "Suffix of the kill files."
3465   :group 'gnus-score-kill
3466   :group 'gnus-score-files
3467   :type 'string)
3468
3469 (defun gnus-newsgroup-kill-file (newsgroup)
3470   "Return the name of a kill file name for NEWSGROUP.
3471 If NEWSGROUP is nil, return the global kill file name instead."
3472   (cond
3473    ;; The global KILL file is placed at top of the directory.
3474    ((or (null newsgroup)
3475         (string-equal newsgroup ""))
3476     (expand-file-name gnus-kill-file-name
3477                       gnus-kill-files-directory))
3478    ;; Append ".KILL" to newsgroup name.
3479    ((gnus-use-long-file-name 'not-kill)
3480     (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup)
3481                               "." gnus-kill-file-name)
3482                       gnus-kill-files-directory))
3483    ;; Place "KILL" under the hierarchical directory.
3484    (t
3485     (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
3486                               "/" gnus-kill-file-name)
3487                       gnus-kill-files-directory))))
3488
3489 ;;; Server things.
3490
3491 (defun gnus-member-of-valid (symbol group)
3492   "Find out if GROUP has SYMBOL as part of its \"valid\" spec."
3493   (memq symbol (assoc
3494                 (symbol-name (car (gnus-find-method-for-group group)))
3495                 gnus-valid-select-methods)))
3496
3497 (defun gnus-method-option-p (method option)
3498   "Return non-nil if select METHOD has OPTION as a parameter."
3499   (when (stringp method)
3500     (setq method (gnus-server-to-method method)))
3501   (memq option (assoc (format "%s" (car method))
3502                       gnus-valid-select-methods)))
3503
3504 (defun gnus-similar-server-opened (method)
3505   (let ((opened gnus-opened-servers))
3506     (while (and method opened)
3507       (when (and (equal (cadr method) (cadaar opened))
3508                  (equal (car method) (caaar opened))
3509                  (not (equal method (caar opened))))
3510         (setq method nil))
3511       (pop opened))
3512     (not method)))
3513
3514 (defun gnus-server-extend-method (group method)
3515   ;; This function "extends" a virtual server.  If the server is
3516   ;; "hello", and the select method is ("hello" (my-var "something"))
3517   ;; in the group "alt.alt", this will result in a new virtual server
3518   ;; called "hello+alt.alt".
3519   (if (or (not (inline (gnus-similar-server-opened method)))
3520           (not (cddr method)))
3521       method
3522     `(,(car method) ,(concat (cadr method) "+" group)
3523       (,(intern (format "%s-address" (car method))) ,(cadr method))
3524       ,@(cddr method))))
3525
3526 (defun gnus-server-status (method)
3527   "Return the status of METHOD."
3528   (nth 1 (assoc method gnus-opened-servers)))
3529
3530 (defun gnus-group-name-to-method (group)
3531   "Guess a select method based on GROUP."
3532   (if (string-match ":" group)
3533       (let ((server (substring group 0 (match-beginning 0))))
3534         (if (string-match "\\+" server)
3535             (list (intern (substring server 0 (match-beginning 0)))
3536                   (substring server (match-end 0)))
3537           (list (intern server) "")))
3538     gnus-select-method))
3539
3540 (defun gnus-server-string (server)
3541   "Return a readable string that describes SERVER."
3542   (let* ((server (gnus-server-to-method server))
3543          (address (nth 1 server)))
3544     (if (and address
3545              (not (zerop (length address))))
3546         (format "%s using %s" address (car server))
3547       (format "%s" (car server)))))
3548
3549 (defun gnus-find-method-for-group (group &optional info)
3550   "Find the select method that GROUP uses."
3551   (or gnus-override-method
3552       (and (not group)
3553            gnus-select-method)
3554       (and (not (gnus-group-entry group));; a new group
3555            (gnus-group-name-to-method group))
3556       (let ((info (or info (gnus-get-info group)))
3557             method)
3558         (if (or (not info)
3559                 (not (setq method (gnus-info-method info)))
3560                 (equal method "native"))
3561             gnus-select-method
3562           (setq method
3563                 (cond ((stringp method)
3564                        (inline (gnus-server-to-method method)))
3565                       ((stringp (cadr method))
3566                        (inline (gnus-server-extend-method group method)))
3567                       (t
3568                        method)))
3569           (cond ((equal (cadr method) "")
3570                  method)
3571                 ((null (cadr method))
3572                  (list (car method) ""))
3573                 (t
3574                  (gnus-server-add-address method)))))))
3575
3576 (defun gnus-methods-using (feature)
3577   "Find all methods that have FEATURE."
3578   (let ((valids gnus-valid-select-methods)
3579         outs)
3580     (while valids
3581       (when (memq feature (car valids))
3582         (push (car valids) outs))
3583       (setq valids (cdr valids)))
3584     outs))
3585
3586 (defun gnus-read-group (prompt &optional default)
3587   "Prompt the user for a group name.
3588 Disallow invalid group names."
3589   (let ((prefix "")
3590         group)
3591     (while (not group)
3592       (when (string-match
3593              gnus-invalid-group-regexp
3594              (setq group (read-string (concat prefix prompt)
3595                                       (cons (or default "") 0)
3596                                       'gnus-group-history)))
3597         (setq prefix (format "Invalid group name: \"%s\".  " group)
3598               group nil)))
3599     group))
3600
3601 (defun gnus-read-method (prompt)
3602   "Prompt the user for a method.
3603 Allow completion over sensible values."
3604   (let* ((open-servers
3605           (mapcar (lambda (i) (cons (format "%s:%s" (caar i) (cadar i)) i))
3606                   gnus-opened-servers))
3607          (valid-methods
3608           (let (methods)
3609             (dolist (method gnus-valid-select-methods)
3610               (if (or (memq 'prompt-address method)
3611                       (not (assoc (format "%s:" (car method)) open-servers)))
3612                   (push method methods)))
3613             methods))
3614          (servers
3615           (append valid-methods
3616                   open-servers
3617                   gnus-predefined-server-alist
3618                   gnus-server-alist))
3619          (method
3620           (completing-read
3621            prompt servers
3622            nil t nil 'gnus-method-history)))
3623     (cond
3624      ((equal method "")
3625       (setq method gnus-select-method))
3626      ((assoc method gnus-valid-select-methods)
3627       (let ((address (if (memq 'prompt-address
3628                                (assoc method gnus-valid-select-methods))
3629                          (read-string "Address: ")
3630                        "")))
3631         (or (cadr (assoc (format "%s:%s" method address) open-servers))
3632             (list (intern method) address))))
3633      ((assoc method servers)
3634       method)
3635      (t
3636       (list (intern method) "")))))
3637
3638 ;;; Agent functions
3639
3640 (defun gnus-agent-method-p (method)
3641   "Say whether METHOD is covered by the agent."
3642   (member method gnus-agent-covered-methods))
3643
3644 (defun gnus-online (method)
3645   (not
3646    (if gnus-plugged
3647        (eq (cadr (assoc method gnus-opened-servers)) 'offline)
3648      (gnus-agent-method-p method))))
3649
3650 ;;; User-level commands.
3651
3652 ;;;###autoload
3653 (defun gnus-slave-no-server (&optional arg)
3654   "Read network news as a slave, without connecting to the local server."
3655   (interactive "P")
3656   (gnus-no-server arg t))
3657
3658 ;;;###autoload
3659 (defun gnus-no-server (&optional arg slave)
3660   "Read network news.
3661 If ARG is a positive number, Gnus will use that as the startup
3662 level. If ARG is nil, Gnus will be started at level 2.  If ARG is
3663 non-nil and not a positive number, Gnus will prompt the user for the
3664 name of an NNTP server to use.
3665 As opposed to `gnus', this command will not connect to the local
3666 server."
3667   (interactive "P")
3668   (gnus-no-server-1 arg slave))
3669
3670 ;;;###autoload
3671 (defun gnus-slave (&optional arg)
3672   "Read news as a slave."
3673   (interactive "P")
3674   (gnus arg nil 'slave))
3675
3676 (defcustom gnus-frame-properties nil
3677   "The properties of the frame in which gnus is displayed. Under XEmacs,
3678 the variable `toolbar-news-frame-plist' will be refered instead."
3679   :type '(repeat (cons :format "%v"
3680                        (symbol :tag "Parameter")
3681                        (sexp :tag "Value")))
3682   :group 'gnus)
3683
3684 ;;;###autoload
3685 (defun gnus-other-frame (&optional arg display)
3686   "Pop up a frame to read news.
3687 This will call one of the Gnus commands which is specified by the user
3688 option `gnus-other-frame-function' (default `gnus') with the argument
3689 ARG if Gnus is not running, otherwise just pop up a Gnus frame.  The
3690 optional second argument DISPLAY should be a standard display string
3691 such as \"unix:0\" to specify where to pop up a frame.  If DISPLAY is
3692 omitted or the function `make-frame-on-display' is not available, the
3693 current display is used."
3694   (interactive "P")
3695   (if (fboundp 'make-frame-on-display)
3696       (unless display
3697         (setq display (gnus-frame-or-window-display-name (selected-frame))))
3698     (setq display nil))
3699   (let ((alive (gnus-alive-p)))
3700     (unless (and alive
3701                  (catch 'found
3702                    (walk-windows
3703                     (lambda (window)
3704                       (when (and (or (not display)
3705                                      (equal display
3706                                             (gnus-frame-or-window-display-name
3707                                              window)))
3708                                  (with-current-buffer (window-buffer window)
3709                                    (string-match "\\`gnus-"
3710                                                  (symbol-name major-mode))))
3711                         (gnus-select-frame-set-input-focus
3712                          (setq gnus-other-frame-object (window-frame window)))
3713                         (select-window window)
3714                         (throw 'found t)))
3715                     'ignore t)))
3716       (gnus-select-frame-set-input-focus
3717        (setq gnus-other-frame-object
3718              (if display
3719                  (make-frame-on-display display gnus-other-frame-parameters)
3720                (make-frame gnus-other-frame-parameters))))
3721       (if alive
3722           (switch-to-buffer gnus-group-buffer)
3723         (funcall gnus-other-frame-function arg)
3724         (add-hook 'gnus-exit-gnus-hook
3725                   (lambda nil
3726                     (when (and (frame-live-p gnus-other-frame-object)
3727                                (cdr (frame-list)))
3728                       (delete-frame gnus-other-frame-object))
3729                     (setq gnus-other-frame-object nil)))))))
3730
3731 ;;;###autoload
3732 (defun gnus (&optional arg dont-connect slave)
3733   "Read network news.
3734 If ARG is non-nil and a positive number, Gnus will use that as the
3735 startup level.  If ARG is non-nil and not a positive number, Gnus will
3736 prompt the user for the name of an NNTP server to use."
3737   (interactive "P")
3738   (unless (byte-code-function-p (symbol-function 'gnus))
3739     (message "You should byte-compile Gnus")
3740     (sit-for 2))
3741   (gnus-1 arg dont-connect slave))
3742
3743 ;; Allow redefinition of Gnus functions.
3744
3745 (gnus-ems-redefine)
3746
3747 (product-provide (provide 'gnus) 'gnus-vers)
3748
3749 ;;; gnus.el ends here