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