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