f9ba14690c46f0a447f742bb3b4781e8c6ed3f51
[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   :group 'gnus-group-select
1269   :type 'integer)
1270
1271 (defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v xenix)))
1272   "*Non-nil means that the default name of a file to save articles in is the group name.
1273 If it's nil, the directory form of the group name is used instead.
1274
1275 If this variable is a list, and the list contains the element
1276 `not-score', long file names will not be used for score files; if it
1277 contains the element `not-save', long file names will not be used for
1278 saving; and if it contains the element `not-kill', long file names
1279 will not be used for kill files.
1280
1281 Note that the default for this variable varies according to what system
1282 type you're using.  On `usg-unix-v' and `xenix' this variable defaults
1283 to nil while on all other systems it defaults to t."
1284   :group 'gnus-start
1285   :type 'boolean)
1286
1287 (defcustom gnus-kill-files-directory gnus-directory
1288   "*Name of the directory where kill files will be stored (default \"~/News\")."
1289   :group 'gnus-score-files
1290   :group 'gnus-score-kill
1291   :type 'directory)
1292
1293 (defcustom gnus-save-score nil
1294   "*If non-nil, save group scoring info."
1295   :group 'gnus-score-various
1296   :group 'gnus-start
1297   :type 'boolean)
1298
1299 (defcustom gnus-use-undo t
1300   "*If non-nil, allow undoing in Gnus group mode buffers."
1301   :group 'gnus-meta
1302   :type 'boolean)
1303
1304 (defcustom gnus-use-adaptive-scoring nil
1305   "*If non-nil, use some adaptive scoring scheme.
1306 If a list, then the values `word' and `line' are meaningful.  The
1307 former will perform adaption on individual words in the subject
1308 header while `line' will perform adaption on several headers."
1309   :group 'gnus-meta
1310   :group 'gnus-score-adapt
1311   :type '(set (const word) (const line)))
1312
1313 (defcustom gnus-use-cache 'passive
1314   "*If nil, Gnus will ignore the article cache.
1315 If `passive', it will allow entering (and reading) articles
1316 explicitly entered into the cache.  If anything else, use the
1317 cache to the full extent of the law."
1318   :group 'gnus-meta
1319   :group 'gnus-cache
1320   :type '(choice (const :tag "off" nil)
1321                  (const :tag "passive" passive)
1322                  (const :tag "active" t)))
1323
1324 (defcustom gnus-use-trees nil
1325   "*If non-nil, display a thread tree buffer."
1326   :group 'gnus-meta
1327   :type 'boolean)
1328
1329 (defcustom gnus-use-grouplens nil
1330   "*If non-nil, use GroupLens ratings."
1331   :group 'gnus-meta
1332   :type 'boolean)
1333
1334 (defcustom gnus-keep-backlog nil
1335   "*If non-nil, Gnus will keep read articles for later re-retrieval.
1336 If it is a number N, then Gnus will only keep the last N articles
1337 read.  If it is neither nil nor a number, Gnus will keep all read
1338 articles.  This is not a good idea."
1339   :group 'gnus-meta
1340   :type '(choice (const :tag "off" nil)
1341                  integer
1342                  (sexp :format "all"
1343                        :value t)))
1344
1345 (defcustom gnus-use-nocem nil
1346   "*If non-nil, Gnus will read NoCeM cancel messages."
1347   :group 'gnus-meta
1348   :type 'boolean)
1349
1350 (defcustom gnus-suppress-duplicates nil
1351   "*If non-nil, Gnus will mark duplicate copies of the same article as read."
1352   :group 'gnus-meta
1353   :type 'boolean)
1354
1355 (defcustom gnus-use-scoring t
1356   "*If non-nil, enable scoring."
1357   :group 'gnus-meta
1358   :type 'boolean)
1359
1360 (defcustom gnus-use-picons nil
1361   "*If non-nil, display picons in a frame of their own."
1362   :group 'gnus-meta
1363   :type 'boolean)
1364
1365 (defcustom gnus-summary-prepare-exit-hook
1366   '(gnus-summary-expire-articles)
1367   "*A hook called when preparing to exit from the summary buffer.
1368 It calls `gnus-summary-expire-articles' by default."
1369   :group 'gnus-summary-exit
1370   :type 'hook)
1371
1372 (defcustom gnus-novice-user t
1373   "*Non-nil means that you are a usenet novice.
1374 If non-nil, verbose messages may be displayed and confirmations may be
1375 required."
1376   :group 'gnus-meta
1377   :type 'boolean)
1378
1379 (defcustom gnus-expert-user nil
1380   "*Non-nil means that you will never be asked for confirmation about anything.
1381 That doesn't mean *anything* anything; particularly destructive
1382 commands will still require prompting."
1383   :group 'gnus-meta
1384   :type 'boolean)
1385
1386 (defcustom gnus-interactive-catchup t
1387   "*If non-nil, require your confirmation when catching up a group."
1388   :group 'gnus-group-select
1389   :type 'boolean)
1390
1391 (defcustom gnus-interactive-exit t
1392   "*If non-nil, require your confirmation when exiting Gnus."
1393   :group 'gnus-exit
1394   :type 'boolean)
1395
1396 (defcustom gnus-extract-address-components 'gnus-extract-address-components
1397   "Function for extracting address components from a From header.
1398 Three pre-defined functions exist: `gnus-extract-address-components',
1399 which is the default, quite fast, and too simplistic solution,
1400 `mail-extract-address-components', which works much better, but is
1401 slower, and `std11-extract-address-components'."
1402   :group 'gnus-summary-format
1403   :type '(radio (function-item gnus-extract-address-components)
1404                 (function-item mail-extract-address-components)
1405                 (function-item std11-extract-address-components)
1406                 (function :tag "Other")))
1407
1408 (defcustom gnus-carpal nil
1409   "*If non-nil, display clickable icons."
1410   :group 'gnus-meta
1411   :type 'boolean)
1412
1413 (defcustom gnus-shell-command-separator ";"
1414   "String used to separate to shell commands."
1415   :group 'gnus-files
1416   :type 'string)
1417
1418 (defcustom gnus-valid-select-methods
1419   '(("nntp" post address prompt-address physical-address)
1420     ("nnspool" post address)
1421     ("nnvirtual" post-mail virtual prompt-address)
1422     ("nnmbox" mail respool address)
1423     ("nnml" post-mail respool address)
1424     ("nnmh" mail respool address)
1425     ("nndir" post-mail prompt-address physical-address)
1426     ("nneething" none address prompt-address physical-address)
1427     ("nndoc" none address prompt-address)
1428     ("nnbabyl" mail address respool)
1429     ("nnkiboze" post virtual)
1430     ("nnsoup" post-mail address)
1431     ("nndraft" post-mail)
1432     ("nnfolder" mail respool address)
1433     ("nngateway" post-mail address prompt-address physical-address)
1434     ("nnweb" none)
1435     ("nnslashdot" post)
1436     ("nnultimate" none)
1437     ("nnrss" none)
1438     ("nnwfm" none)
1439     ("nnwarchive" none)
1440     ("nnlistserv" none)
1441     ("nnagent" post-mail)
1442     ("nnimap" post-mail address prompt-address physical-address))
1443   "*An alist of valid select methods.
1444 The first element of each list lists should be a string with the name
1445 of the select method.  The other elements may be the category of
1446 this method (i. e., `post', `mail', `none' or whatever) or other
1447 properties that this method has (like being respoolable).
1448 If you implement a new select method, all you should have to change is
1449 this variable.  I think."
1450   :group 'gnus-server
1451   :type '(repeat (group (string :tag "Name")
1452                         (radio-button-choice (const :format "%v " post)
1453                                              (const :format "%v " mail)
1454                                              (const :format "%v " none)
1455                                              (const post-mail))
1456                         (checklist :inline t
1457                                    (const :format "%v " address)
1458                                    (const :format "%v " prompt-address)
1459                                    (const :format "%v " physical-address)
1460                                    (const :format "%v " virtual)
1461                                    (const respool)))))
1462
1463 (defun gnus-redefine-select-method-widget ()
1464   "Recomputes the select-method widget based on the value of
1465 `gnus-valid-select-methods'."
1466   (define-widget 'gnus-select-method 'list
1467     "Widget for entering a select method."
1468     :value '(nntp "")
1469     :tag "Select Method"
1470     :args `((choice :tag "Method"
1471                     ,@(mapcar (lambda (entry)
1472                                 (list 'const :format "%v\n"
1473                                       (intern (car entry))))
1474                               gnus-valid-select-methods)
1475                     (symbol :tag "other"))
1476             (string :tag "Address")
1477             (repeat :tag "Options"
1478                     :inline t
1479                     (list :format "%v"
1480                           variable
1481                           (sexp :tag "Value"))))))
1482
1483 (gnus-redefine-select-method-widget)
1484
1485 (defcustom gnus-updated-mode-lines '(group article summary tree)
1486   "List of buffers that should update their mode lines.
1487 The list may contain the symbols `group', `article', `tree' and
1488 `summary'.  If the corresponding symbol is present, Gnus will keep
1489 that mode line updated with information that may be pertinent.
1490 If this variable is nil, screen refresh may be quicker."
1491   :group 'gnus-various
1492   :type '(set (const group)
1493               (const article)
1494               (const summary)
1495               (const tree)))
1496
1497 ;; Added by Keinonen Kari <kk85613@cs.tut.fi>.
1498 (defcustom gnus-mode-non-string-length nil
1499   "*Max length of mode-line non-string contents.
1500 If this is nil, Gnus will take space as is needed, leaving the rest
1501 of the modeline intact.  Note that the default of nil is unlikely
1502 to be desirable; see the manual for further details."
1503   :group 'gnus-various
1504   :type '(choice (const nil)
1505                  integer))
1506
1507 ;; There should be special validation for this.
1508 (define-widget 'gnus-email-address 'string
1509   "An email address")
1510
1511 (gnus-define-group-parameter
1512  to-address
1513  :function-document
1514  "Return GROUP's to-address."
1515  :variable-document
1516  "*Alist of group regexps and correspondent to-addresses."
1517  :parameter-type '(gnus-email-address :tag "To Address")
1518  :parameter-document "\
1519 This will be used when doing followups and posts.
1520
1521 This is primarily useful in mail groups that represent closed
1522 mailing lists--mailing lists where it's expected that everybody that
1523 writes to the mailing list is subscribed to it.  Since using this
1524 parameter ensures that the mail only goes to the mailing list itself,
1525 it means that members won't receive two copies of your followups.
1526
1527 Using `to-address' will actually work whether the group is foreign or
1528 not.  Let's say there's a group on the server that is called
1529 `fa.4ad-l'.  This is a real newsgroup, but the server has gotten the
1530 articles from a mail-to-news gateway.  Posting directly to this group
1531 is therefore impossible--you have to send mail to the mailing list
1532 address instead.
1533
1534 The gnus-group-split mail splitting mechanism will behave as if this
1535 address was listed in gnus-group-split Addresses (see below).")
1536
1537 (gnus-define-group-parameter
1538  to-list
1539  :function-document
1540  "Return GROUP's to-list."
1541  :variable-document
1542  "*Alist of group regexps and correspondent to-lists."
1543  :parameter-type '(gnus-email-address :tag "To List")
1544  :parameter-document "\
1545 This address will be used when doing a `a' in the group.
1546
1547 It is totally ignored when doing a followup--except that if it is
1548 present in a news group, you'll get mail group semantics when doing
1549 `f'.
1550
1551 The gnus-group-split mail splitting mechanism will behave as if this
1552 address was listed in gnus-group-split Addresses (see below).")
1553
1554 (gnus-define-group-parameter
1555  auto-expire
1556  :type bool
1557  :function gnus-group-auto-expirable-p
1558  :function-document
1559  "Check whether GROUP is auto-expirable or not."
1560  :variable gnus-auto-expirable-newsgroups
1561  :variable-default nil
1562  :variable-document
1563  "*Groups in which to automatically mark read articles as expirable.
1564 If non-nil, this should be a regexp that should match all groups in
1565 which to perform auto-expiry.  This only makes sense for mail groups."
1566  :variable-group nnmail-expire
1567  :variable-type '(choice (const nil)
1568                          regexp)
1569  :parameter-type '(const :tag "Automatic Expire" t)
1570  :parameter-document
1571  "All articles that are read will be marked as expirable.")
1572
1573 (gnus-define-group-parameter
1574  total-expire
1575  :type bool
1576  :function gnus-group-total-expirable-p
1577  :function-document
1578  "Check whether GROUP is total-expirable or not."
1579  :variable gnus-total-expirable-newsgroups
1580  :variable-default nil
1581  :variable-document
1582  "*Groups in which to perform expiry of all read articles.
1583 Use with extreme caution.  All groups that match this regexp will be
1584 expiring - which means that all read articles will be deleted after
1585 \(say) one week.         (This only goes for mail groups and the like, of
1586 course.)"
1587  :variable-group nnmail-expire
1588  :variable-type '(choice (const nil)
1589                          regexp)
1590  :parameter-type '(const :tag "Total Expire" t)
1591  :parameter-document
1592  "All read articles will be put through the expiry process
1593
1594 This happens even if they are not marked as expirable.
1595 Use with caution.")
1596
1597 (gnus-define-group-parameter
1598  charset
1599  :function-document
1600  "Return the default charset of GROUP."
1601  :variable gnus-group-charset-alist
1602  :variable-default
1603  '(("\\(^\\|:\\)hk\\>\\|\\(^\\|:\\)tw\\>\\|\\<big5\\>" cn-big5)
1604    ("\\(^\\|:\\)cn\\>\\|\\<chinese\\>" cn-gb-2312)
1605    ("\\(^\\|:\\)fj\\>\\|\\(^\\|:\\)japan\\>" iso-2022-jp-2)
1606    ("\\(^\\|:\\)tnn\\>\\|\\(^\\|:\\)pin\\>\\|\\(^\\|:\\)sci.lang.japan" iso-2022-7bit)
1607    ("\\(^\\|:\\)relcom\\>" koi8-r)
1608    ("\\(^\\|:\\)fido7\\>" koi8-r)
1609    ("\\(^\\|:\\)\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
1610    ("\\(^\\|:\\)israel\\>" iso-8859-1)
1611    ("\\(^\\|:\\)han\\>" euc-kr)
1612    ("\\(^\\|:\\)alt.chinese.text.big5\\>" chinese-big5)
1613    ("\\(^\\|:\\)soc.culture.vietnamese\\>" vietnamese-viqr)
1614    ("\\(^\\|:\\)\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)
1615    (".*" iso-8859-1))
1616  :variable-document
1617  "Alist of regexps (to match group names) and default charsets to be used when reading."
1618  :variable-group gnus-charset
1619  :variable-type '(repeat (list (regexp :tag "Group")
1620                                (symbol :tag "Charset")))
1621  :parameter-type '(symbol :tag "Charset")
1622  :parameter-document "\
1623 The default charset to use in the group.")
1624
1625 (defcustom gnus-group-uncollapsed-levels 1
1626   "Number of group name elements to leave alone when making a short group name."
1627   :group 'gnus-group-visual
1628   :type 'integer)
1629
1630 (defcustom gnus-group-use-permanent-levels nil
1631   "*If non-nil, once you set a level, Gnus will use this level."
1632   :group 'gnus-group-levels
1633   :type 'boolean)
1634
1635 ;; Hooks.
1636
1637 (defcustom gnus-load-hook nil
1638   "A hook run while Gnus is loaded."
1639   :group 'gnus-start
1640   :type 'hook)
1641
1642 (defcustom gnus-apply-kill-hook '(gnus-apply-kill-file)
1643   "A hook called to apply kill files to a group.
1644 This hook is intended to apply a kill file to the selected newsgroup.
1645 The function `gnus-apply-kill-file' is called by default.
1646
1647 Since a general kill file is too heavy to use only for a few
1648 newsgroups, I recommend you to use a lighter hook function.  For
1649 example, if you'd like to apply a kill file to articles which contains
1650 a string `rmgroup' in subject in newsgroup `control', you can use the
1651 following hook:
1652
1653  (setq gnus-apply-kill-hook
1654       (list
1655         (lambda ()
1656           (cond ((string-match \"control\" gnus-newsgroup-name)
1657                  (gnus-kill \"Subject\" \"rmgroup\")
1658                  (gnus-expunge \"X\"))))))"
1659   :group 'gnus-score-kill
1660   :options '(gnus-apply-kill-file)
1661   :type 'hook)
1662
1663 (defcustom gnus-group-change-level-function nil
1664   "Function run when a group level is changed.
1665 It is called with three parameters -- GROUP, LEVEL and OLDLEVEL."
1666   :group 'gnus-group-levels
1667   :type 'function)
1668
1669 ;;; Face thingies.
1670
1671 (defcustom gnus-visual
1672   '(summary-highlight group-highlight article-highlight
1673                       mouse-face
1674                       summary-menu group-menu article-menu
1675                       tree-highlight menu highlight
1676                       browse-menu server-menu
1677                       page-marker tree-menu binary-menu pick-menu
1678                       grouplens-menu)
1679   "*Enable visual features.
1680 If `visual' is disabled, there will be no menus and few faces.  Most of
1681 the visual customization options below will be ignored.  Gnus will use
1682 less space and be faster as a result.
1683
1684 This variable can also be a list of visual elements to switch on.  For
1685 instance, to switch off all visual things except menus, you can say:
1686
1687    (setq gnus-visual '(menu))
1688
1689 Valid elements include `summary-highlight', `group-highlight',
1690 `article-highlight', `mouse-face', `summary-menu', `group-menu',
1691 `article-menu', `tree-highlight', `menu', `highlight', `browse-menu',
1692 `server-menu', `page-marker', `tree-menu', `binary-menu', `pick-menu',
1693 and `grouplens-menu'."
1694   :group 'gnus-meta
1695   :group 'gnus-visual
1696   :type '(set (const summary-highlight)
1697               (const group-highlight)
1698               (const article-highlight)
1699               (const mouse-face)
1700               (const summary-menu)
1701               (const group-menu)
1702               (const article-menu)
1703               (const tree-highlight)
1704               (const menu)
1705               (const highlight)
1706               (const browse-menu)
1707               (const server-menu)
1708               (const page-marker)
1709               (const tree-menu)
1710               (const binary-menu)
1711               (const pick-menu)
1712               (const grouplens-menu)))
1713
1714 (defcustom gnus-mouse-face
1715   (condition-case ()
1716       (if (gnus-visual-p 'mouse-face 'highlight)
1717           (if (boundp 'gnus-mouse-face)
1718               (or gnus-mouse-face 'highlight)
1719             'highlight)
1720         'default)
1721     (error 'highlight))
1722   "*Face used for group or summary buffer mouse highlighting.
1723 The line beneath the mouse pointer will be highlighted with this
1724 face."
1725   :group 'gnus-visual
1726   :type 'face)
1727
1728 (defcustom gnus-article-save-directory gnus-directory
1729   "*Name of the directory articles will be saved in (default \"~/News\")."
1730   :group 'gnus-article-saving
1731   :type 'directory)
1732
1733 (defvar gnus-plugged t
1734   "Whether Gnus is plugged or not.")
1735
1736 (defcustom gnus-default-charset 'iso-8859-1
1737   "Default charset assumed to be used when viewing non-ASCII characters.
1738 This variable is overridden on a group-to-group basis by the
1739 gnus-group-charset-alist variable and is only used on groups not
1740 covered by that variable."
1741   :type 'symbol
1742   :group 'gnus-charset)
1743
1744 \f
1745 ;;; Internal variables
1746
1747 (defvar gnus-agent-gcc-header "X-Gnus-Agent-Gcc")
1748 (defvar gnus-agent-meta-information-header "X-Gnus-Agent-Meta-Information")
1749 (defvar gnus-draft-meta-information-header "X-Draft-From")
1750 (defvar gnus-group-get-parameter-function 'gnus-group-get-parameter)
1751 (defvar gnus-original-article-buffer " *Original Article*")
1752 (defvar gnus-newsgroup-name nil)
1753 (defvar gnus-ephemeral-servers nil)
1754
1755 (defvar gnus-agent nil
1756   "Whether we want to use the Gnus agent or not.")
1757
1758 (defvar gnus-agent-fetching nil
1759   "Whether Gnus agent is in fetching mode.")
1760
1761 (defvar gnus-command-method nil
1762   "Dynamically bound variable that says what the current backend is.")
1763
1764 (defvar gnus-current-select-method nil
1765   "The current method for selecting a newsgroup.")
1766
1767 (defvar gnus-tree-buffer "*Tree*"
1768   "Buffer where Gnus thread trees are displayed.")
1769
1770 ;; Dummy variable.
1771 (defvar gnus-use-generic-from nil)
1772
1773 ;; Variable holding the user answers to all method prompts.
1774 (defvar gnus-method-history nil)
1775
1776 ;; Variable holding the user answers to all mail method prompts.
1777 (defvar gnus-mail-method-history nil)
1778
1779 ;; Variable holding the user answers to all group prompts.
1780 (defvar gnus-group-history nil)
1781
1782 (defvar gnus-server-alist nil
1783   "List of available servers.")
1784
1785 (defcustom gnus-cache-directory
1786   (nnheader-concat gnus-directory "cache/")
1787   "*The directory where cached articles will be stored."
1788   :group 'gnus-cache
1789   :type 'directory)
1790
1791 (defvar gnus-predefined-server-alist
1792   `(("cache"
1793      nnspool "cache"
1794      (nnspool-spool-directory ,gnus-cache-directory)
1795      (nnspool-nov-directory ,gnus-cache-directory)
1796      (nnspool-active-file
1797       ,(nnheader-concat gnus-cache-directory "active"))))
1798   "List of predefined (convenience) servers.")
1799
1800 (defvar gnus-topic-indentation "");; Obsolete variable.
1801
1802 (defconst gnus-article-mark-lists
1803   '((marked . tick) (replied . reply)
1804     (expirable . expire) (killed . killed)
1805     (bookmarks . bookmark) (dormant . dormant)
1806     (scored . score) (saved . save)
1807     (cached . cache) (downloadable . download)
1808     (unsendable . unsend) (forwarded . forward)))
1809
1810 (defvar gnus-headers-retrieved-by nil)
1811 (defvar gnus-article-reply nil)
1812 (defvar gnus-override-method nil)
1813 (defvar gnus-article-check-size nil)
1814 (defvar gnus-opened-servers nil)
1815
1816 (defvar gnus-current-kill-article nil)
1817
1818 (defvar gnus-have-read-active-file nil)
1819
1820 (defconst gnus-maintainer
1821   "semi-gnus-ja@meadowy.org (T-gnus Bugfixing Girls + Boys)"
1822   "The mail address of the T-gnus maintainers.")
1823
1824 (defcustom gnus-info-filename nil
1825   "*Controls language of gnus Info.
1826 If nil and current-language-environment is Japanese, go to gnus-ja.
1827 Otherwise go to corresponding Info.
1828 This variable can be nil, gnus or gnus-ja."
1829   :group 'gnus-start
1830   :type '(choice (const nil)
1831                  (const :tag "English" gnus)
1832                  (const :tag "Japanese" gnus-ja)))
1833
1834 (defvar gnus-info-nodes
1835   '((gnus-group-mode "Group Buffer")
1836     (gnus-summary-mode "Summary Buffer")
1837     (gnus-article-mode "Article Buffer")
1838     (gnus-server-mode "Server Buffer")
1839     (gnus-browse-mode "Browse Foreign Server")
1840     (gnus-tree-mode "Tree Display"))
1841   "Alist of major modes and related Info nodes.")
1842
1843 (defvar gnus-group-buffer "*Group*")
1844 (defvar gnus-summary-buffer "*Summary*")
1845 (defvar gnus-article-buffer "*Article*")
1846 (defvar gnus-server-buffer "*Server*")
1847
1848 (defvar gnus-slave nil
1849   "Whether this Gnus is a slave or not.")
1850
1851 (defvar gnus-batch-mode nil
1852   "Whether this Gnus is running in batch mode or not.")
1853
1854 (defvar gnus-variable-list
1855   '(gnus-newsrc-options gnus-newsrc-options-n
1856                         gnus-newsrc-last-checked-date
1857                         gnus-newsrc-alist gnus-server-alist
1858                         gnus-killed-list gnus-zombie-list
1859                         gnus-topic-topology gnus-topic-alist)
1860   "Gnus variables saved in the quick startup file.")
1861
1862 (defvar gnus-product-variable-file-list
1863   (let ((version (product-version (product-find 'gnus-vers)))
1864         (codesys (static-if (boundp 'MULE) '*ctext* 'ctext)))
1865     `(("strict-cache" ((product-version ,version) (emacs-version))
1866        binary
1867        gnus-format-specs-compiled)
1868       ("cache" ((product-version ,version) (emacs-version))
1869        ,codesys
1870        gnus-format-specs)))
1871   "Gnus variables are saved in the produce depend quick startup files.")
1872
1873 (defcustom gnus-compile-user-specs t
1874   "If non-nil, the user-defined format specs will be byte-compiled
1875 automatically.
1876 It has an effect on the values of `gnus-*-line-format-spec'."
1877   :group 'gnus
1878   :type 'boolean)
1879
1880 (defvar gnus-newsrc-alist nil
1881   "Assoc list of read articles.
1882 gnus-newsrc-hashtb should be kept so that both hold the same information.")
1883
1884 (defvar gnus-newsrc-hashtb nil
1885   "Hashtable of gnus-newsrc-alist.")
1886
1887 (defvar gnus-killed-list nil
1888   "List of killed newsgroups.")
1889
1890 (defvar gnus-killed-hashtb nil
1891   "Hash table equivalent of gnus-killed-list.")
1892
1893 (defvar gnus-zombie-list nil
1894   "List of almost dead newsgroups.")
1895
1896 (defvar gnus-description-hashtb nil
1897   "Descriptions of newsgroups.")
1898
1899 (defvar gnus-list-of-killed-groups nil
1900   "List of newsgroups that have recently been killed by the user.")
1901
1902 (defvar gnus-active-hashtb nil
1903   "Hashtable of active articles.")
1904
1905 (defvar gnus-moderated-hashtb nil
1906   "Hashtable of moderated newsgroups.")
1907
1908 ;; Save window configuration.
1909 (defvar gnus-prev-winconf nil)
1910
1911 (defvar gnus-reffed-article-number nil)
1912
1913 ;;; Let the byte-compiler know that we know about this variable.
1914 (defvar rmail-default-rmail-file)
1915
1916 (defvar gnus-dead-summary nil)
1917
1918 (defvar gnus-invalid-group-regexp "[: `'\"/]\\|^$"
1919   "Regexp matching invalid groups.")
1920
1921 ;;; End of variables.
1922
1923 ;; Define some autoload functions Gnus might use.
1924 (eval-and-compile
1925
1926   ;; This little mapcar goes through the list below and marks the
1927   ;; symbols in question as autoloaded functions.
1928   (mapcar
1929    (lambda (package)
1930      (let ((interactive (nth 1 (memq ':interactive package))))
1931        (mapcar
1932         (lambda (function)
1933           (let (keymap)
1934             (when (consp function)
1935               (setq keymap (car (memq 'keymap function)))
1936               (setq function (car function)))
1937             (unless (fboundp function)
1938               (autoload function (car package) nil interactive keymap))))
1939         (if (eq (nth 1 package) ':interactive)
1940             (nthcdr 3 package)
1941           (cdr package)))))
1942    '(("info" :interactive t Info-goto-node)
1943      ("pp" pp-to-string)
1944      ("ps-print" ps-print-preprint)
1945      ("message" :interactive t
1946       message-send-and-exit message-yank-original)
1947      ("babel" babel-as-string)
1948      ("nnmail" nnmail-split-fancy nnmail-article-group)
1949      ("nnvirtual" nnvirtual-catchup-group nnvirtual-convert-headers)
1950      ("rmailout" rmail-output rmail-output-to-rmail-file)
1951      ("rmail" rmail-insert-rmail-file-header rmail-count-new-messages
1952       rmail-show-message rmail-summary-exists
1953       rmail-select-summary rmail-update-summary)
1954      ("gnus-audio" :interactive t gnus-audio-play)
1955      ("gnus-xmas" gnus-xmas-splash)
1956      ("gnus-soup" :interactive t
1957       gnus-group-brew-soup gnus-brew-soup gnus-soup-add-article
1958       gnus-soup-send-replies gnus-soup-save-areas gnus-soup-pack-packet)
1959      ("nnsoup" nnsoup-pack-replies)
1960      ("score-mode" :interactive t gnus-score-mode)
1961      ("gnus-mh" gnus-summary-save-article-folder
1962       gnus-Folder-save-name gnus-folder-save-name)
1963      ("gnus-mh" :interactive t gnus-summary-save-in-folder)
1964      ("gnus-demon" gnus-demon-add-nocem gnus-demon-add-scanmail
1965       gnus-demon-add-rescan gnus-demon-add-scan-timestamps
1966       gnus-demon-add-disconnection gnus-demon-add-handler
1967       gnus-demon-remove-handler)
1968      ("gnus-demon" :interactive t
1969       gnus-demon-init gnus-demon-cancel)
1970      ("gnus-salt" gnus-highlight-selected-tree gnus-possibly-generate-tree
1971       gnus-tree-open gnus-tree-close gnus-carpal-setup-buffer)
1972      ("gnus-nocem" gnus-nocem-scan-groups gnus-nocem-close
1973       gnus-nocem-unwanted-article-p)
1974      ("gnus-srvr" gnus-enter-server-buffer gnus-server-set-info
1975       gnus-server-server-name)
1976      ("gnus-srvr" gnus-browse-foreign-server)
1977      ("gnus-cite" :interactive t
1978       gnus-article-highlight-citation gnus-article-hide-citation-maybe
1979       gnus-article-hide-citation gnus-article-fill-cited-article
1980       gnus-article-hide-citation-in-followups)
1981      ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
1982       gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
1983       gnus-execute gnus-expunge gnus-batch-kill gnus-batch-score)
1984      ("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
1985       gnus-cache-possibly-remove-articles gnus-cache-request-article
1986       gnus-cache-retrieve-headers gnus-cache-possibly-alter-active
1987       gnus-cache-enter-remove-article gnus-cached-article-p
1988       gnus-cache-open gnus-cache-close gnus-cache-update-article
1989       gnus-cache-articles-in-group)
1990      ("gnus-cache" :interactive t gnus-jog-cache gnus-cache-enter-article
1991       gnus-cache-remove-article gnus-summary-insert-cached-articles)
1992      ("gnus-score" :interactive t
1993       gnus-summary-increase-score gnus-summary-set-score
1994       gnus-summary-raise-thread gnus-summary-raise-same-subject
1995       gnus-summary-raise-score gnus-summary-raise-same-subject-and-select
1996       gnus-summary-lower-thread gnus-summary-lower-same-subject
1997       gnus-summary-lower-score gnus-summary-lower-same-subject-and-select
1998       gnus-summary-current-score gnus-score-delta-default
1999       gnus-score-flush-cache gnus-score-close
2000       gnus-possibly-score-headers gnus-score-followup-article
2001       gnus-score-followup-thread)
2002      ("gnus-score"
2003       (gnus-summary-score-map keymap) gnus-score-save gnus-score-headers
2004       gnus-current-score-file-nondirectory gnus-score-adaptive
2005       gnus-score-find-trace gnus-score-file-name)
2006      ("gnus-cus" :interactive t gnus-custom-mode gnus-group-customize
2007       gnus-score-customize)
2008      ("gnus-topic" :interactive t gnus-topic-mode)
2009      ("gnus-topic" gnus-topic-remove-group gnus-topic-set-parameters
2010       gnus-subscribe-topics)
2011      ("gnus-salt" :interactive t gnus-pick-mode gnus-binary-mode)
2012      ("gnus-uu" (gnus-uu-extract-map keymap) (gnus-uu-mark-map keymap))
2013      ("gnus-uu" :interactive t
2014       gnus-uu-digest-mail-forward gnus-uu-digest-post-forward
2015       gnus-uu-mark-series gnus-uu-mark-region gnus-uu-mark-buffer
2016       gnus-uu-mark-by-regexp gnus-uu-mark-all
2017       gnus-uu-mark-sparse gnus-uu-mark-thread gnus-uu-decode-uu
2018       gnus-uu-decode-uu-and-save gnus-uu-decode-unshar
2019       gnus-uu-decode-unshar-and-save gnus-uu-decode-save
2020       gnus-uu-decode-binhex gnus-uu-decode-uu-view
2021       gnus-uu-decode-uu-and-save-view gnus-uu-decode-unshar-view
2022       gnus-uu-decode-unshar-and-save-view gnus-uu-decode-save-view
2023       gnus-uu-decode-binhex-view gnus-uu-unmark-thread
2024       gnus-uu-mark-over gnus-uu-post-news)
2025      ("gnus-uu" gnus-uu-delete-work-dir gnus-quote-arg-for-sh-or-csh
2026       gnus-uu-unmark-thread)
2027      ("gnus-msg" (gnus-summary-send-map keymap)
2028       gnus-article-mail gnus-copy-article-buffer gnus-following-method)
2029      ("gnus-msg" :interactive t
2030       gnus-group-post-news gnus-group-mail gnus-summary-post-news
2031       gnus-summary-followup gnus-summary-followup-with-original
2032       gnus-summary-cancel-article gnus-summary-supersede-article
2033       gnus-post-news gnus-summary-reply gnus-summary-reply-with-original
2034       gnus-summary-mail-forward gnus-summary-mail-other-window
2035       gnus-summary-resend-message gnus-summary-resend-bounced-mail
2036       gnus-summary-wide-reply gnus-summary-followup-to-mail
2037       gnus-summary-followup-to-mail-with-original gnus-bug
2038       gnus-summary-wide-reply-with-original gnus-summary-post-forward
2039       gnus-summary-digest-mail-forward gnus-summary-digest-post-forward)
2040      ("gnus-picon" :interactive t gnus-article-display-picons
2041       gnus-group-display-picons)
2042      ("gnus-picon" gnus-picons-buffer-name)
2043      ("gnus-gl" bbb-login bbb-logout bbb-grouplens-group-p
2044       gnus-grouplens-mode)
2045      ("smiley" :interactive t gnus-smiley-display)
2046      ("gnus-win" gnus-configure-windows gnus-add-configuration)
2047      ("gnus-sum" gnus-summary-insert-line gnus-summary-read-group
2048       gnus-list-of-unread-articles gnus-list-of-read-articles
2049       gnus-offer-save-summaries gnus-make-thread-indent-array
2050       gnus-summary-exit gnus-update-read-articles gnus-summary-last-subject
2051       gnus-summary-skip-intangible gnus-summary-article-number
2052       gnus-data-header gnus-data-find gnus-summary-jump-to-other-group)
2053      ("gnus-group" gnus-group-insert-group-line gnus-group-quit
2054       gnus-group-list-groups gnus-group-first-unread-group
2055       gnus-group-set-mode-line gnus-group-set-info gnus-group-save-newsrc
2056       gnus-group-setup-buffer gnus-group-get-new-news
2057       gnus-group-make-help-group gnus-group-update-group
2058       gnus-group-iterate gnus-group-group-name)
2059      ("gnus-bcklg" gnus-backlog-request-article gnus-backlog-enter-article
2060       gnus-backlog-remove-article)
2061      ("gnus-art" gnus-article-read-summary-keys gnus-article-save
2062       gnus-article-prepare gnus-article-set-window-start
2063       gnus-article-next-page gnus-article-prev-page
2064       gnus-request-article-this-buffer gnus-article-mode
2065       gnus-article-setup-buffer gnus-narrow-to-page
2066       gnus-article-delete-invisible-text gnus-treat-article)
2067      ("gnus-art" :interactive t
2068       gnus-article-hide-headers gnus-article-hide-boring-headers
2069       gnus-article-treat-overstrike
2070       gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
2071       gnus-article-display-x-face
2072       gnus-article-decode-HZ
2073       gnus-article-wash-html
2074       gnus-article-hide-pgp
2075       gnus-article-hide-pem gnus-article-hide-signature
2076       gnus-article-strip-leading-blank-lines gnus-article-date-local
2077       gnus-article-date-original gnus-article-date-lapsed
2078       gnus-article-show-all-headers gnus-article-show-all
2079       gnus-article-edit-mode gnus-article-edit-article
2080       gnus-article-edit-done article-decode-encoded-words
2081       gnus-start-date-timer gnus-stop-date-timer
2082       gnus-article-toggle-headers)
2083      ("gnus-int" gnus-request-type)
2084      ("gnus-start" gnus-newsrc-parse-options gnus-1 gnus-no-server-1
2085       gnus-dribble-enter gnus-read-init-file gnus-dribble-touch)
2086      ("gnus-dup" gnus-dup-suppress-articles gnus-dup-unsuppress-article
2087       gnus-dup-enter-articles)
2088      ("gnus-range" gnus-copy-sequence)
2089      ("gnus-eform" gnus-edit-form)
2090      ("gnus-move" :interactive t
2091       gnus-group-move-group-to-server gnus-change-server)
2092      ("gnus-logic" gnus-score-advanced)
2093      ("gnus-undo" gnus-undo-mode gnus-undo-register)
2094      ("gnus-async" gnus-async-request-fetched-article gnus-async-prefetch-next
2095       gnus-async-prefetch-article gnus-async-prefetch-remove-group
2096       gnus-async-halt-prefetch)
2097      ("gnus-offline"
2098       gnus-offline-setup)
2099      ("gnus-offline" :interactive t
2100       gnus-offline-toggle-plugged
2101       gnus-offline-set-unplugged-state
2102       gnus-offline-toggle-auto-hangup
2103       gnus-offline-toggle-on/off-send-mail
2104       gnus-offline-toggle-articles-to-fetch
2105       gnus-offline-set-interval-time
2106       gnus-offline-agent-expire)
2107      ("miee" :interactive t gnspool-get-news
2108       mail-spool-send news-spool-post)
2109      ("international/mw32misc" define-process-argument-editing
2110       general-process-argument-editing-function)
2111      ("gnus-agent" gnus-open-agent gnus-agent-get-function
2112       gnus-agent-save-groups gnus-agent-save-active gnus-agent-method-p
2113       gnus-agent-get-undownloaded-list gnus-agent-fetch-session
2114       gnus-summary-set-agent-mark gnus-agent-save-group-info)
2115      ("gnus-agent" :interactive t
2116       gnus-unplugged gnus-agentize gnus-agent-batch)
2117      ("gnus-vm" :interactive t gnus-summary-save-in-vm
2118       gnus-summary-save-article-vm)
2119      ("gnus-draft" :interactive t gnus-draft-mode gnus-group-send-drafts)
2120      ("gnus-mlspl" gnus-group-split gnus-group-split-fancy)
2121      ("gnus-mlspl" :interactive t gnus-group-split-setup
2122       gnus-group-split-update))))
2123
2124 (eval-and-compile
2125   (unless (featurep 'xemacs)
2126     (if (>= emacs-major-version 21)
2127         (autoload 'x-face-decode-message-header "x-face-e21")
2128       (autoload 'gnus-smiley-display "gnus-bitmap" nil t)
2129       (autoload 'smiley-toggle-buffer "gnus-bitmap")
2130       (autoload 'x-face-mule-gnus-article-display-x-face "x-face-mule"))))
2131
2132 (unless (and (fboundp 'base64-encode-string)
2133              (subrp (symbol-function 'base64-encode-string)))
2134   (require 'base64))
2135
2136 ;; To make shimbun groups.
2137 (autoload 'gnus-group-make-shimbun-group "nnshimbun" nil t)
2138
2139 ;; A tool for the developers.
2140 (autoload 'find-cl-run-time-functions "gnus-clfns" nil t)
2141
2142 ;;; gnus-sum.el thingies
2143
2144
2145 (defcustom gnus-summary-line-format "%U%R%z%I%(%[%4L: %-20,20n%]%) %s\n"
2146   "*The format specification of the lines in the summary buffer.
2147
2148 It works along the same lines as a normal formatting string,
2149 with some simple extensions.
2150
2151 %N   Article number, left padded with spaces (string)
2152 %S   Subject (string)
2153 %s   Subject if it is at the root of a thread, and \"\" otherwise (string)
2154 %n   Name of the poster (string)
2155 %a   Extracted name of the poster (string)
2156 %A   Extracted address of the poster (string)
2157 %F   Contents of the From: header (string)
2158 %f   Contents of the From: or To: headers (string)
2159 %x   Contents of the Xref: header (string)
2160 %D   Date of the article (string)
2161 %d   Date of the article (string) in DD-MMM format
2162 %o   Date of the article (string) in YYYYMMDD`T'HHMMSS format
2163 %M   Message-id of the article (string)
2164 %r   References of the article (string)
2165 %c   Number of characters in the article (integer)
2166 %L   Number of lines in the article (integer)
2167 %I   Indentation based on thread level (a string of spaces)
2168 %B   A complex trn-style thread tree (string)
2169 %T   A string with two possible values: 80 spaces if the article
2170      is on thread level two or larger and 0 spaces on level one
2171 %R   \"A\" if this article has been replied to, \" \" otherwise (character)
2172 %U   Status of this article (character, \"R\", \"K\", \"-\" or \" \")
2173 %[   Opening bracket (character, \"[\" or \"<\")
2174 %]   Closing bracket (character, \"]\" or \">\")
2175 %>   Spaces of length thread-level (string)
2176 %<   Spaces of length (- 20 thread-level) (string)
2177 %i   Article score (number)
2178 %z   Article zcore (character)
2179 %t   Number of articles under the current thread (number).
2180 %e   Whether the thread is empty or not (character).
2181 %l   GroupLens score (string).
2182 %V   Total thread score (number).
2183 %P   The line number (number).
2184 %O   Download mark (character).
2185 %u   User defined specifier.  The next character in the format string should
2186      be a letter.  Gnus will call the function gnus-user-format-function-X,
2187      where X is the letter following %u.  The function will be passed the
2188      current header as argument.  The function should return a string, which
2189      will be inserted into the summary just like information from any other
2190      summary specifier.
2191
2192 Text between %( and %) will be highlighted with `gnus-mouse-face'
2193 when the mouse point is placed inside the area.  There can only be one
2194 such area.
2195
2196 The %U (status), %R (replied) and %z (zcore) specs have to be handled
2197 with care.  For reasons of efficiency, Gnus will compute what column
2198 these characters will end up in, and \"hard-code\" that.  This means that
2199 it is invalid to have these specs after a variable-length spec.  Well,
2200 you might not be arrested, but your summary buffer will look strange,
2201 which is bad enough.
2202
2203 The smart choice is to have these specs as far to the left as
2204 possible.
2205
2206 This restriction may disappear in later versions of Gnus."
2207   :type 'string
2208   :group 'gnus-summary-format)
2209
2210 ;;;
2211 ;;; Skeleton keymaps
2212 ;;;
2213
2214 (defun gnus-suppress-keymap (keymap)
2215   (suppress-keymap keymap)
2216   (let ((keys `([backspace] [delete] "\177" "\M-u"))) ;gnus-mouse-2
2217     (while keys
2218       (define-key keymap (pop keys) 'undefined))))
2219
2220 (defvar gnus-article-mode-map
2221   (let ((keymap (make-sparse-keymap)))
2222     (gnus-suppress-keymap keymap)
2223     keymap))
2224 (defvar gnus-summary-mode-map
2225   (let ((keymap (make-keymap)))
2226     (gnus-suppress-keymap keymap)
2227     keymap))
2228 (defvar gnus-group-mode-map
2229   (let ((keymap (make-keymap)))
2230     (gnus-suppress-keymap keymap)
2231     keymap))
2232
2233 \f
2234
2235 ;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
2236 ;; If you want the cursor to go somewhere else, set these two
2237 ;; functions in some startup hook to whatever you want.
2238 (defalias 'gnus-summary-position-point 'gnus-goto-colon)
2239 (defalias 'gnus-group-position-point 'gnus-goto-colon)
2240
2241 ;;; Various macros and substs.
2242
2243 (defun gnus-header-from (header)
2244   (mail-header-from header))
2245
2246 (defmacro gnus-gethash (string hashtable)
2247   "Get hash value of STRING in HASHTABLE."
2248   `(symbol-value (intern-soft ,string ,hashtable)))
2249
2250 (defmacro gnus-sethash (string value hashtable)
2251   "Set hash value.  Arguments are STRING, VALUE, and HASHTABLE."
2252   `(set (intern ,string ,hashtable) ,value))
2253 (put 'gnus-sethash 'edebug-form-spec '(form form form))
2254
2255 (defmacro gnus-group-unread (group)
2256   "Get the currently computed number of unread articles in GROUP."
2257   `(car (gnus-gethash ,group gnus-newsrc-hashtb)))
2258
2259 (defmacro gnus-group-entry (group)
2260   "Get the newsrc entry for GROUP."
2261   `(gnus-gethash ,group gnus-newsrc-hashtb))
2262
2263 (defmacro gnus-active (group)
2264   "Get active info on GROUP."
2265   `(gnus-gethash ,group gnus-active-hashtb))
2266
2267 (defmacro gnus-set-active (group active)
2268   "Set GROUP's active info."
2269   `(gnus-sethash ,group ,active gnus-active-hashtb))
2270
2271 ;; Info access macros.
2272
2273 (defmacro gnus-info-group (info)
2274   `(nth 0 ,info))
2275 (defmacro gnus-info-rank (info)
2276   `(nth 1 ,info))
2277 (defmacro gnus-info-read (info)
2278   `(nth 2 ,info))
2279 (defmacro gnus-info-marks (info)
2280   `(nth 3 ,info))
2281 (defmacro gnus-info-method (info)
2282   `(nth 4 ,info))
2283 (defmacro gnus-info-params (info)
2284   `(nth 5 ,info))
2285
2286 (defmacro gnus-info-level (info)
2287   `(let ((rank (gnus-info-rank ,info)))
2288      (if (consp rank)
2289          (car rank)
2290        rank)))
2291 (defmacro gnus-info-score (info)
2292   `(let ((rank (gnus-info-rank ,info)))
2293      (or (and (consp rank) (cdr rank)) 0)))
2294
2295 (defmacro gnus-info-set-group (info group)
2296   `(setcar ,info ,group))
2297 (defmacro gnus-info-set-rank (info rank)
2298   `(setcar (nthcdr 1 ,info) ,rank))
2299 (defmacro gnus-info-set-read (info read)
2300   `(setcar (nthcdr 2 ,info) ,read))
2301 (defmacro gnus-info-set-marks (info marks &optional extend)
2302   (if extend
2303       `(gnus-info-set-entry ,info ,marks 3)
2304     `(setcar (nthcdr 3 ,info) ,marks)))
2305 (defmacro gnus-info-set-method (info method &optional extend)
2306   (if extend
2307       `(gnus-info-set-entry ,info ,method 4)
2308     `(setcar (nthcdr 4 ,info) ,method)))
2309 (defmacro gnus-info-set-params (info params &optional extend)
2310   (if extend
2311       `(gnus-info-set-entry ,info ,params 5)
2312     `(setcar (nthcdr 5 ,info) ,params)))
2313
2314 (defun gnus-info-set-entry (info entry number)
2315   ;; Extend the info until we have enough elements.
2316   (while (<= (length info) number)
2317     (nconc info (list nil)))
2318   ;; Set the entry.
2319   (setcar (nthcdr number info) entry))
2320
2321 (defmacro gnus-info-set-level (info level)
2322   `(let ((rank (cdr ,info)))
2323      (if (consp (car rank))
2324          (setcar (car rank) ,level)
2325        (setcar rank ,level))))
2326 (defmacro gnus-info-set-score (info score)
2327   `(let ((rank (cdr ,info)))
2328      (if (consp (car rank))
2329          (setcdr (car rank) ,score)
2330        (setcar rank (cons (car rank) ,score)))))
2331
2332 (defmacro gnus-get-info (group)
2333   `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
2334
2335 ;; Byte-compiler warning.
2336 (defvar gnus-visual)
2337 ;; Find out whether the gnus-visual TYPE is wanted.
2338 (defun gnus-visual-p (&optional type class)
2339   (and gnus-visual                      ; Has to be non-nil, at least.
2340        (if (not type)                   ; We don't care about type.
2341            gnus-visual
2342          (if (listp gnus-visual)        ; It's a list, so we check it.
2343              (or (memq type gnus-visual)
2344                  (memq class gnus-visual))
2345            t))))
2346
2347 ;;; Load the compatability functions.
2348
2349 (require 'gnus-ems)
2350
2351 \f
2352 ;;;
2353 ;;; Shutdown
2354 ;;;
2355
2356 (defvar gnus-shutdown-alist nil)
2357
2358 (defun gnus-add-shutdown (function &rest symbols)
2359   "Run FUNCTION whenever one of SYMBOLS is shut down."
2360   (push (cons function symbols) gnus-shutdown-alist))
2361
2362 (defun gnus-shutdown (symbol)
2363   "Shut down everything that waits for SYMBOL."
2364   (let ((alist gnus-shutdown-alist)
2365         entry)
2366     (while (setq entry (pop alist))
2367       (when (memq symbol (cdr entry))
2368         (funcall (car entry))))))
2369
2370 \f
2371 ;;;
2372 ;;; Gnus Utility Functions
2373 ;;;
2374
2375
2376 (defmacro gnus-string-or (&rest strings)
2377   "Return the first element of STRINGS that is a non-blank string.
2378 STRINGS will be evaluated in normal `or' order."
2379   `(gnus-string-or-1 ',strings))
2380
2381 (defun gnus-string-or-1 (strings)
2382   (let (string)
2383     (while strings
2384       (setq string (eval (pop strings)))
2385       (if (string-match "^[ \t]*$" string)
2386           (setq string nil)
2387         (setq strings nil)))
2388     string))
2389
2390 (defun gnus-info-find-node ()
2391   "Find Info documentation of Gnus."
2392   (interactive)
2393   ;; Enlarge info window if needed.
2394   (let (gnus-info-buffer)
2395     (Info-goto-node
2396      (format "(%s)%s"
2397              (or gnus-info-filename
2398                  (get-language-info current-language-environment 'gnus-info)
2399                  "gnus")
2400              (or (cadr (assq major-mode gnus-info-nodes))
2401                  (and (eq (current-buffer) (get-buffer gnus-article-buffer))
2402                       (cadr (assq 'gnus-article-mode gnus-info-nodes))))))
2403     (setq gnus-info-buffer (current-buffer))
2404     (gnus-configure-windows 'info)))
2405
2406 ;;;
2407 ;;; gnus-interactive
2408 ;;;
2409
2410 (defvar gnus-current-prefix-symbol nil
2411   "Current prefix symbol.")
2412
2413 (defvar gnus-current-prefix-symbols nil
2414   "List of current prefix symbols.")
2415
2416 (defun gnus-interactive (string &optional params)
2417   "Return a list that can be fed to `interactive'.
2418 See `interactive' for full documentation.
2419
2420 Adds the following specs:
2421
2422 y -- The current symbolic prefix.
2423 Y -- A list of the current symbolic prefix(es).
2424 A -- Article number.
2425 H -- Article header.
2426 g -- Group name."
2427   (let ((i 0)
2428         out c prompt)
2429     (while (< i (length string))
2430       (string-match ".\\([^\n]*\\)\n?" string i)
2431       (setq c (aref string i))
2432       (when (match-end 1)
2433         (setq prompt (match-string 1 string)))
2434       (setq i (match-end 0))
2435       ;; We basically emulate just about everything that
2436       ;; `interactive' does, but add the specs listed above.
2437       (push
2438        (cond
2439         ((= c ?a)
2440          (completing-read prompt obarray 'fboundp t))
2441         ((= c ?b)
2442          (read-buffer prompt (current-buffer) t))
2443         ((= c ?B)
2444          (read-buffer prompt (other-buffer (current-buffer))))
2445         ((= c ?c)
2446          (read-char))
2447         ((= c ?C)
2448          (completing-read prompt obarray 'commandp t))
2449         ((= c ?d)
2450          (point))
2451         ((= c ?D)
2452          (read-file-name prompt nil default-directory 'lambda))
2453         ((= c ?f)
2454          (read-file-name prompt nil nil 'lambda))
2455         ((= c ?F)
2456          (read-file-name prompt))
2457         ((= c ?k)
2458          (read-key-sequence prompt))
2459         ((= c ?K)
2460          (error "Not implemented spec"))
2461         ((= c ?e)
2462          (error "Not implemented spec"))
2463         ((= c ?m)
2464          (mark))
2465         ((= c ?N)
2466          (error "Not implemented spec"))
2467         ((= c ?n)
2468          (string-to-number (read-from-minibuffer prompt)))
2469         ((= c ?p)
2470          (prefix-numeric-value current-prefix-arg))
2471         ((= c ?P)
2472          current-prefix-arg)
2473         ((= c ?r)
2474          'gnus-prefix-nil)
2475         ((= c ?s)
2476          (read-string prompt))
2477         ((= c ?S)
2478          (intern (read-string prompt)))
2479         ((= c ?v)
2480          (read-variable prompt))
2481         ((= c ?x)
2482          (read-minibuffer prompt))
2483         ((= c ?x)
2484          (eval-minibuffer prompt))
2485         ;; And here the new specs come.
2486         ((= c ?y)
2487          gnus-current-prefix-symbol)
2488         ((= c ?Y)
2489          gnus-current-prefix-symbols)
2490         ((= c ?g)
2491          (gnus-group-group-name))
2492         ((= c ?A)
2493          (gnus-summary-skip-intangible)
2494          (or (get-text-property (point) 'gnus-number)
2495              (gnus-summary-last-subject)))
2496         ((= c ?H)
2497          (gnus-data-header (gnus-data-find (gnus-summary-article-number))))
2498         (t
2499          (error "Non-implemented spec")))
2500        out)
2501       (cond
2502        ((= c ?r)
2503         (push (if (< (point) (mark)) (point) (mark)) out)
2504         (push (if (> (point) (mark)) (point) (mark)) out))))
2505     (setq out (delq 'gnus-prefix-nil out))
2506     (nreverse out)))
2507
2508 (defun gnus-symbolic-argument (&optional arg)
2509   "Read a symbolic argument and a command, and then execute command."
2510   (interactive "P")
2511   (let* ((in-command (this-command-keys))
2512          (command in-command)
2513          gnus-current-prefix-symbols
2514          gnus-current-prefix-symbol
2515          syms)
2516     (while (equal in-command command)
2517       (message "%s-" (key-description (this-command-keys)))
2518       (push (intern (char-to-string (read-char))) syms)
2519       (setq command (read-key-sequence nil t)))
2520     (setq gnus-current-prefix-symbols (nreverse syms)
2521           gnus-current-prefix-symbol (car gnus-current-prefix-symbols))
2522     (call-interactively (key-binding command t))))
2523
2524 ;;; More various functions.
2525
2526 (defsubst gnus-check-backend-function (func group)
2527   "Check whether GROUP supports function FUNC.
2528 GROUP can either be a string (a group name) or a select method."
2529   (ignore-errors
2530     (let ((method (if (stringp group)
2531                       (car (gnus-find-method-for-group group))
2532                     group)))
2533       (unless (featurep method)
2534         (require method))
2535       (fboundp (intern (format "%s-%s" method func))))))
2536
2537 (defun gnus-group-read-only-p (&optional group)
2538   "Check whether GROUP supports editing or not.
2539 If GROUP is nil, `gnus-newsgroup-name' will be checked instead.  Note
2540 that that variable is buffer-local to the summary buffers."
2541   (let ((group (or group gnus-newsgroup-name)))
2542     (not (gnus-check-backend-function 'request-replace-article group))))
2543
2544 (defun gnus-virtual-group-p (group)
2545   "Say whether GROUP is virtual or not."
2546   (memq 'virtual (assoc (symbol-name (car (gnus-find-method-for-group group)))
2547                         gnus-valid-select-methods)))
2548
2549 (defun gnus-news-group-p (group &optional article)
2550   "Return non-nil if GROUP (and ARTICLE) come from a news server."
2551   (or (gnus-member-of-valid 'post group) ; Ordinary news group.
2552       (and (gnus-member-of-valid 'post-mail group) ; Combined group.
2553            (if (or (null article)
2554                    (not (< article 0)))
2555                (eq (gnus-request-type group article) 'news)
2556              (if (not (vectorp article))
2557                  nil
2558                ;; It's a real article.
2559                (eq (gnus-request-type group (mail-header-id article))
2560                    'news))))))
2561
2562 ;; Returns a list of writable groups.
2563 (defun gnus-writable-groups ()
2564   (let ((alist gnus-newsrc-alist)
2565         groups group)
2566     (while (setq group (car (pop alist)))
2567       (unless (gnus-group-read-only-p group)
2568         (push group groups)))
2569     (nreverse groups)))
2570
2571 ;; Check whether to use long file names.
2572 (defun gnus-use-long-file-name (symbol)
2573   ;; The variable has to be set...
2574   (and gnus-use-long-file-name
2575        ;; If it isn't a list, then we return t.
2576        (or (not (listp gnus-use-long-file-name))
2577            ;; If it is a list, and the list contains `symbol', we
2578            ;; return nil.
2579            (not (memq symbol gnus-use-long-file-name)))))
2580
2581 ;; Generate a unique new group name.
2582 (defun gnus-generate-new-group-name (leaf)
2583   (let ((name leaf)
2584         (num 0))
2585     (while (gnus-gethash name gnus-newsrc-hashtb)
2586       (setq name (concat leaf "<" (int-to-string (setq num (1+ num))) ">")))
2587     name))
2588
2589 (defun gnus-ephemeral-group-p (group)
2590   "Say whether GROUP is ephemeral or not."
2591   (gnus-group-get-parameter group 'quit-config t))
2592
2593 (defun gnus-group-quit-config (group)
2594   "Return the quit-config of GROUP."
2595   (gnus-group-get-parameter group 'quit-config t))
2596
2597 (defun gnus-kill-ephemeral-group (group)
2598   "Remove ephemeral GROUP from relevant structures."
2599   (gnus-sethash group nil gnus-newsrc-hashtb))
2600
2601 (defun gnus-simplify-mode-line ()
2602   "Make mode lines a bit simpler."
2603   (setq mode-line-modified (cdr gnus-mode-line-modified))
2604   (when (listp mode-line-format)
2605     (make-local-variable 'mode-line-format)
2606     (setq mode-line-format (copy-sequence mode-line-format))
2607     (when (equal (nth 3 mode-line-format) "   ")
2608       (setcar (nthcdr 3 mode-line-format) " "))))
2609
2610 ;;; Servers and groups.
2611
2612 (defsubst gnus-server-add-address (method)
2613   (let ((method-name (symbol-name (car method))))
2614     (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
2615              (not (assq (intern (concat method-name "-address")) method))
2616              (memq 'physical-address (assq (car method)
2617                                            gnus-valid-select-methods)))
2618         (append method (list (list (intern (concat method-name "-address"))
2619                                    (nth 1 method))))
2620       method)))
2621
2622 (defsubst gnus-server-get-method (group method)
2623   ;; Input either a server name, and extended server name, or a
2624   ;; select method, and return a select method.
2625   (cond ((stringp method)
2626          (gnus-server-to-method method))
2627         ((equal method gnus-select-method)
2628          gnus-select-method)
2629         ((and (stringp (car method))
2630               group)
2631          (gnus-server-extend-method group method))
2632         ((and method
2633               (not group)
2634               (equal (cadr method) ""))
2635          method)
2636         (t
2637          (gnus-server-add-address method))))
2638
2639 (defun gnus-server-to-method (server)
2640   "Map virtual server names to select methods."
2641   (or
2642    ;; Is this a method, perhaps?
2643    (and server (listp server) server)
2644    ;; Perhaps this is the native server?
2645    (and (equal server "native") gnus-select-method)
2646    ;; It should be in the server alist.
2647    (cdr (assoc server gnus-server-alist))
2648    ;; It could be in the predefined server alist.
2649    (cdr (assoc server gnus-predefined-server-alist))
2650    ;; If not, we look through all the opened server
2651    ;; to see whether we can find it there.
2652    (let ((opened gnus-opened-servers))
2653      (while (and opened
2654                  (not (equal server (format "%s:%s" (caaar opened)
2655                                             (cadaar opened)))))
2656        (pop opened))
2657      (caar opened))
2658    ;; It could be a named method, search all servers
2659    (let ((servers gnus-secondary-select-methods))
2660      (while (and servers
2661                  (not (equal server (format "%s:%s" (caar servers)
2662                                             (cadar servers)))))
2663        (pop servers))
2664      (car servers))))
2665
2666 (defmacro gnus-method-equal (ss1 ss2)
2667   "Say whether two servers are equal."
2668   `(let ((s1 ,ss1)
2669          (s2 ,ss2))
2670      (or (equal s1 s2)
2671          (and (= (length s1) (length s2))
2672               (progn
2673                 (while (and s1 (member (car s1) s2))
2674                   (setq s1 (cdr s1)))
2675                 (null s1))))))
2676
2677 (defun gnus-methods-equal-p (m1 m2)
2678   (let ((m1 (or m1 gnus-select-method))
2679         (m2 (or m2 gnus-select-method)))
2680     (or (equal m1 m2)
2681         (and (eq (car m1) (car m2))
2682              (or (not (memq 'address (assoc (symbol-name (car m1))
2683                                             gnus-valid-select-methods)))
2684                  (equal (nth 1 m1) (nth 1 m2)))))))
2685
2686 (defun gnus-server-equal (m1 m2)
2687   "Say whether two methods are equal."
2688   (let ((m1 (cond ((null m1) gnus-select-method)
2689                   ((stringp m1) (gnus-server-to-method m1))
2690                   (t m1)))
2691         (m2 (cond ((null m2) gnus-select-method)
2692                   ((stringp m2) (gnus-server-to-method m2))
2693                   (t m2))))
2694     (gnus-method-equal m1 m2)))
2695
2696 (defun gnus-servers-using-backend (backend)
2697   "Return a list of known servers using BACKEND."
2698   (let ((opened gnus-opened-servers)
2699         out)
2700     (while opened
2701       (when (eq backend (caaar opened))
2702         (push (caar opened) out))
2703       (pop opened))
2704     out))
2705
2706 (defun gnus-archive-server-wanted-p ()
2707   "Say whether the user wants to use the archive server."
2708   (cond
2709    ((or (not gnus-message-archive-method)
2710         (not gnus-message-archive-group))
2711     nil)
2712    ((and gnus-message-archive-method gnus-message-archive-group)
2713     t)
2714    (t
2715     (let ((active (cadr (assq 'nnfolder-active-file
2716                               gnus-message-archive-method))))
2717       (and active
2718            (file-exists-p active))))))
2719
2720 (defsubst gnus-method-to-server-name (method)
2721   (concat
2722    (format "%s" (car method))
2723    (when (and
2724           (or (assoc (format "%s" (car method))
2725                      (gnus-methods-using 'address))
2726               (gnus-server-equal method gnus-message-archive-method))
2727           (nth 1 method)
2728           (not (string= (nth 1 method) "")))
2729      (concat "+" (nth 1 method)))))
2730
2731 (defun gnus-group-prefixed-name (group method)
2732   "Return the whole name from GROUP and METHOD."
2733   (and (stringp method) (setq method (gnus-server-to-method method)))
2734   (if (or (not method)
2735           (gnus-server-equal method "native"))
2736       group
2737     (concat (gnus-method-to-server-name method) ":" group)))
2738
2739 (defun gnus-group-real-prefix (group)
2740   "Return the prefix of the current group name."
2741   (if (string-match "^[^:]+:" group)
2742       (substring group 0 (match-end 0))
2743     ""))
2744
2745 (defun gnus-group-method (group)
2746   "Return the server or method used for selecting GROUP.
2747 You should probably use `gnus-find-method-for-group' instead."
2748   (let ((prefix (gnus-group-real-prefix group)))
2749     (if (equal prefix "")
2750         gnus-select-method
2751       (let ((servers gnus-opened-servers)
2752             (server "")
2753             backend possible found)
2754         (if (string-match "^[^\\+]+\\+" prefix)
2755             (setq backend (intern (substring prefix 0 (1- (match-end 0))))
2756                   server (substring prefix (match-end 0) (1- (length prefix))))
2757           (setq backend (intern (substring prefix 0 (1- (length prefix))))))
2758         (while servers
2759           (when (eq (caaar servers) backend)
2760             (setq possible (caar servers))
2761             (when (equal (cadaar servers) server)
2762               (setq found (caar servers))))
2763           (pop servers))
2764         (or (car (rassoc found gnus-server-alist))
2765             found
2766             (car (rassoc possible gnus-server-alist))
2767             possible
2768             (list backend server))))))
2769
2770 (defsubst gnus-native-method-p (method)
2771   "Return whether METHOD is the native select method."
2772   (gnus-method-equal method gnus-select-method))
2773
2774 (defsubst gnus-secondary-method-p (method)
2775   "Return whether METHOD is a secondary select method."
2776   (let ((methods gnus-secondary-select-methods)
2777         (gmethod (gnus-server-get-method nil method)))
2778     (while (and methods
2779                 (not (gnus-method-equal
2780                       (gnus-server-get-method nil (car methods))
2781                       gmethod)))
2782       (setq methods (cdr methods)))
2783     methods))
2784
2785 (defun gnus-method-simplify (method)
2786   "Return the shortest uniquely identifying string or method for METHOD."
2787   (cond ((stringp method)
2788          method)
2789         ((gnus-native-method-p method)
2790          nil)
2791         ((gnus-secondary-method-p method)
2792          (format "%s:%s" (nth 0 method) (nth 1 method)))
2793         (t
2794          method)))
2795
2796 (defun gnus-groups-from-server (server)
2797   "Return a list of all groups that are fetched from SERVER."
2798   (let ((alist (cdr gnus-newsrc-alist))
2799         info groups)
2800     (while (setq info (pop alist))
2801       (when (gnus-server-equal (gnus-info-method info) server)
2802         (push (gnus-info-group info) groups)))
2803     (sort groups 'string<)))
2804
2805 (defun gnus-group-foreign-p (group)
2806   "Say whether a group is foreign or not."
2807   (and (not (gnus-group-native-p group))
2808        (not (gnus-group-secondary-p group))))
2809
2810 (defun gnus-group-native-p (group)
2811   "Say whether the group is native or not."
2812   (not (string-match ":" group)))
2813
2814 (defun gnus-group-secondary-p (group)
2815   "Say whether the group is secondary or not."
2816   (gnus-secondary-method-p (gnus-find-method-for-group group)))
2817
2818 (defun gnus-parameters-get-parameter (group)
2819   "Return the group parameters for GROUP from `gnus-parameters'."
2820   (let ((alist gnus-parameters)
2821         params-list)
2822     (while alist
2823       (when (string-match (caar alist) group)
2824         (setq params-list
2825               (nconc (copy-sequence (cdar alist))
2826                      params-list)))
2827       (pop alist))
2828     params-list))
2829
2830 (defun gnus-group-find-parameter (group &optional symbol allow-list)
2831   "Return the group parameters for GROUP.
2832 If SYMBOL, return the value of that symbol in the group parameters."
2833   (save-excursion
2834     (set-buffer gnus-group-buffer)
2835     (let ((parameters
2836            (nconc
2837             (copy-sequence
2838              (funcall gnus-group-get-parameter-function group))
2839             (gnus-parameters-get-parameter group))))
2840       (if symbol
2841           (gnus-group-parameter-value parameters symbol allow-list)
2842         parameters))))
2843
2844 (defun gnus-group-get-parameter (group &optional symbol allow-list)
2845   "Return the group parameters for GROUP.
2846 If SYMBOL, return the value of that symbol in the group parameters.
2847 Most functions should use `gnus-group-find-parameter', which
2848 also examines the topic parameters."
2849   (let ((params (gnus-info-params (gnus-get-info group))))
2850     (if symbol
2851         (gnus-group-parameter-value params symbol allow-list)
2852       params)))
2853
2854 (defun gnus-group-parameter-value (params symbol &optional allow-list)
2855   "Return the value of SYMBOL in group PARAMS."
2856   ;; We only wish to return group parameters (dotted lists) and
2857   ;; not local variables, which may have the same names.
2858   ;; But first we handle single elements...
2859   (or (car (memq symbol params))
2860       ;; Handle alist.
2861       (let (elem)
2862         (catch 'found
2863           (while (setq elem (pop params))
2864             (when (and (consp elem)
2865                        (eq (car elem) symbol)
2866                        (or allow-list
2867                            (atom (cdr elem))))
2868               (throw 'found (cdr elem))))))))
2869
2870 (defun gnus-group-add-parameter (group param)
2871   "Add parameter PARAM to GROUP."
2872   (let ((info (gnus-get-info group)))
2873     (when info
2874       (gnus-group-remove-parameter group (if (consp param) (car param) param))
2875       ;; Cons the new param to the old one and update.
2876       (gnus-group-set-info (cons param (gnus-info-params info))
2877                            group 'params))))
2878
2879 (defun gnus-group-set-parameter (group name value)
2880   "Set parameter NAME to VALUE in GROUP."
2881   (let ((info (gnus-get-info group)))
2882     (when info
2883       (gnus-group-remove-parameter group name)
2884       (let ((old-params (gnus-info-params info))
2885             (new-params (list (cons name value))))
2886         (while old-params
2887           (when (or (not (listp (car old-params)))
2888                     (not (eq (caar old-params) name)))
2889             (setq new-params (append new-params (list (car old-params)))))
2890           (setq old-params (cdr old-params)))
2891         (gnus-group-set-info new-params group 'params)))))
2892
2893 (defun gnus-group-remove-parameter (group name)
2894   "Remove parameter NAME from GROUP."
2895   (let ((info (gnus-get-info group)))
2896     (when info
2897       (let ((params (gnus-info-params info)))
2898         (when params
2899           (setq params (delq name params))
2900           (while (assq name params)
2901             (gnus-pull name params))
2902           (gnus-info-set-params info params))))))
2903
2904 (defun gnus-group-add-score (group &optional score)
2905   "Add SCORE to the GROUP score.
2906 If SCORE is nil, add 1 to the score of GROUP."
2907   (let ((info (gnus-get-info group)))
2908     (when info
2909       (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
2910
2911 (defun gnus-short-group-name (group &optional levels)
2912   "Collapse GROUP name LEVELS.
2913 Select methods are stripped and any remote host name is stripped down to
2914 just the host name."
2915   (let* ((name "")
2916          (foreign "")
2917          (depth 0)
2918          (skip 1)
2919          (levels (or levels
2920                      gnus-group-uncollapsed-levels
2921                      (progn
2922                        (while (string-match "\\." group skip)
2923                          (setq skip (match-end 0)
2924                                depth (+ depth 1)))
2925                        depth))))
2926     ;; Separate foreign select method from group name and collapse.
2927     ;; If method contains a server, collapse to non-domain server name,
2928     ;; otherwise collapse to select method.
2929     (let* ((colon (string-match ":" group))
2930            (server (and colon (substring group 0 colon)))
2931            (plus (and server (string-match "+" server))))
2932       (when server
2933         (if plus
2934             (setq foreign (substring server (+ 1 plus)
2935                                      (string-match "\\." server))
2936                   group (substring group (+ 1 colon)))
2937           (setq foreign server
2938                 group (substring group (+ 1 colon))))
2939         (setq foreign (concat foreign ":")))
2940       ;; Collapse group name leaving LEVELS uncollapsed elements
2941       (let* ((slist (split-string group "/"))
2942              (slen (length slist))
2943              (dlist (split-string group "\\."))
2944              (dlen (length dlist))
2945              glist
2946              glen
2947              gsep
2948              res)
2949         (if (> slen dlen)
2950             (setq glist slist
2951                   glen slen
2952                   gsep "/")
2953           (setq glist dlist
2954                 glen dlen
2955                 gsep "."))
2956         (setq levels (- glen levels))
2957         (dolist (g glist)
2958           (push (if (>= (decf levels) 0)
2959                     (if (zerop (length g))
2960                         ""
2961                       (substring g 0 1))
2962                   g)
2963                 res))
2964         (concat foreign (mapconcat 'identity (nreverse res) gsep))))))
2965
2966 (defun gnus-narrow-to-body ()
2967   "Narrow to the body of an article."
2968   (narrow-to-region
2969    (progn
2970      (goto-char (point-min))
2971      (or (search-forward "\n\n" nil t)
2972          (point-max)))
2973    (point-max)))
2974
2975 \f
2976 ;;;
2977 ;;; Kill file handling.
2978 ;;;
2979
2980 (defun gnus-apply-kill-file ()
2981   "Apply a kill file to the current newsgroup.
2982 Returns the number of articles marked as read."
2983   (if (or (file-exists-p (gnus-newsgroup-kill-file nil))
2984           (file-exists-p (gnus-newsgroup-kill-file gnus-newsgroup-name)))
2985       (gnus-apply-kill-file-internal)
2986     0))
2987
2988 (defun gnus-kill-save-kill-buffer ()
2989   (let ((file (gnus-newsgroup-kill-file gnus-newsgroup-name)))
2990     (when (get-file-buffer file)
2991       (save-excursion
2992         (set-buffer (get-file-buffer file))
2993         (when (buffer-modified-p)
2994           (save-buffer))
2995         (kill-buffer (current-buffer))))))
2996
2997 (defcustom gnus-kill-file-name "KILL"
2998   "Suffix of the kill files."
2999   :group 'gnus-score-kill
3000   :group 'gnus-score-files
3001   :type 'string)
3002
3003 (defun gnus-newsgroup-kill-file (newsgroup)
3004   "Return the name of a kill file name for NEWSGROUP.
3005 If NEWSGROUP is nil, return the global kill file name instead."
3006   (cond
3007    ;; The global KILL file is placed at top of the directory.
3008    ((or (null newsgroup)
3009         (string-equal newsgroup ""))
3010     (expand-file-name gnus-kill-file-name
3011                       gnus-kill-files-directory))
3012    ;; Append ".KILL" to newsgroup name.
3013    ((gnus-use-long-file-name 'not-kill)
3014     (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup)
3015                               "." gnus-kill-file-name)
3016                       gnus-kill-files-directory))
3017    ;; Place "KILL" under the hierarchical directory.
3018    (t
3019     (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
3020                               "/" gnus-kill-file-name)
3021                       gnus-kill-files-directory))))
3022
3023 ;;; Server things.
3024
3025 (defun gnus-member-of-valid (symbol group)
3026   "Find out if GROUP has SYMBOL as part of its \"valid\" spec."
3027   (memq symbol (assoc
3028                 (symbol-name (car (gnus-find-method-for-group group)))
3029                 gnus-valid-select-methods)))
3030
3031 (defun gnus-method-option-p (method option)
3032   "Return non-nil if select METHOD has OPTION as a parameter."
3033   (when (stringp method)
3034     (setq method (gnus-server-to-method method)))
3035   (memq option (assoc (format "%s" (car method))
3036                       gnus-valid-select-methods)))
3037
3038 (defun gnus-similar-server-opened (method)
3039   (let ((opened gnus-opened-servers))
3040     (while (and method opened)
3041       (when (and (equal (cadr method) (cadaar opened))
3042                  (equal (car method) (caaar opened))
3043                  (not (equal method (caar opened))))
3044         (setq method nil))
3045       (pop opened))
3046     (not method)))
3047
3048 (defun gnus-server-extend-method (group method)
3049   ;; This function "extends" a virtual server.  If the server is
3050   ;; "hello", and the select method is ("hello" (my-var "something"))
3051   ;; in the group "alt.alt", this will result in a new virtual server
3052   ;; called "hello+alt.alt".
3053   (if (or (not (inline (gnus-similar-server-opened method)))
3054           (not (cddr method)))
3055       method
3056     `(,(car method) ,(concat (cadr method) "+" group)
3057       (,(intern (format "%s-address" (car method))) ,(cadr method))
3058       ,@(cddr method))))
3059
3060 (defun gnus-server-status (method)
3061   "Return the status of METHOD."
3062   (nth 1 (assoc method gnus-opened-servers)))
3063
3064 (defun gnus-group-name-to-method (group)
3065   "Guess a select method based on GROUP."
3066   (if (string-match ":" group)
3067       (let ((server (substring group 0 (match-beginning 0))))
3068         (if (string-match "\\+" server)
3069             (list (intern (substring server 0 (match-beginning 0)))
3070                   (substring server (match-end 0)))
3071           (list (intern server) "")))
3072     gnus-select-method))
3073
3074 (defun gnus-server-string (server)
3075   "Return a readable string that describes SERVER."
3076   (let* ((server (gnus-server-to-method server))
3077          (address (nth 1 server)))
3078     (if (and address
3079              (not (zerop (length address))))
3080         (format "%s via %s" address (car server))
3081       (format "%s" (car server)))))
3082
3083 (defun gnus-find-method-for-group (group &optional info)
3084   "Find the select method that GROUP uses."
3085   (or gnus-override-method
3086       (and (not group)
3087            gnus-select-method)
3088       (and (not (gnus-group-entry group));; a new group
3089            (gnus-group-name-to-method group))
3090       (let ((info (or info (gnus-get-info group)))
3091             method)
3092         (if (or (not info)
3093                 (not (setq method (gnus-info-method info)))
3094                 (equal method "native"))
3095             gnus-select-method
3096           (setq method
3097                 (cond ((stringp method)
3098                        (inline (gnus-server-to-method method)))
3099                       ((stringp (cadr method))
3100                        (inline (gnus-server-extend-method group method)))
3101                       (t
3102                        method)))
3103           (cond ((equal (cadr method) "")
3104                  method)
3105                 ((null (cadr method))
3106                  (list (car method) ""))
3107                 (t
3108                  (gnus-server-add-address method)))))))
3109
3110 (defun gnus-methods-using (feature)
3111   "Find all methods that have FEATURE."
3112   (let ((valids gnus-valid-select-methods)
3113         outs)
3114     (while valids
3115       (when (memq feature (car valids))
3116         (push (car valids) outs))
3117       (setq valids (cdr valids)))
3118     outs))
3119
3120 (defun gnus-read-group (prompt &optional default)
3121   "Prompt the user for a group name.
3122 Disallow invalid group names."
3123   (let ((prefix "")
3124         group)
3125     (while (not group)
3126       (when (string-match
3127              gnus-invalid-group-regexp
3128              (setq group (read-string (concat prefix prompt)
3129                                       (cons (or default "") 0)
3130                                       'gnus-group-history)))
3131         (setq prefix (format "Invalid group name: \"%s\".  " group)
3132               group nil)))
3133     group))
3134
3135 (defun gnus-read-method (prompt)
3136   "Prompt the user for a method.
3137 Allow completion over sensible values."
3138   (let* ((open-servers
3139           (mapcar (lambda (i) (cons (format "%s:%s" (caar i) (cadar i)) i))
3140                   gnus-opened-servers))
3141          (valid-methods
3142           (let (methods)
3143             (dolist (method gnus-valid-select-methods)
3144               (if (or (memq 'prompt-address method)
3145                       (not (assoc (format "%s:" (car method)) open-servers)))
3146                   (push method methods)))
3147             methods))
3148          (servers
3149           (append valid-methods
3150                   open-servers
3151                   gnus-predefined-server-alist
3152                   gnus-server-alist))
3153          (method
3154           (completing-read
3155            prompt servers
3156            nil t nil 'gnus-method-history)))
3157     (cond
3158      ((equal method "")
3159       (setq method gnus-select-method))
3160      ((assoc method gnus-valid-select-methods)
3161       (let ((address (if (memq 'prompt-address
3162                                (assoc method gnus-valid-select-methods))
3163                          (read-string "Address: ")
3164                        "")))
3165         (or (cadr (assoc (format "%s:%s" method address) open-servers))
3166             (list (intern method) address))))
3167      ((assoc method servers)
3168       method)
3169      (t
3170       (list (intern method) "")))))
3171
3172 ;;; User-level commands.
3173
3174 ;;;###autoload
3175 (defun gnus-slave-no-server (&optional arg)
3176   "Read network news as a slave, without connecting to local server."
3177   (interactive "P")
3178   (gnus-no-server arg t))
3179
3180 ;;;###autoload
3181 (defun gnus-no-server (&optional arg slave)
3182   "Read network news.
3183 If ARG is a positive number, Gnus will use that as the
3184 startup level.  If ARG is nil, Gnus will be started at level 2.
3185 If ARG is non-nil and not a positive number, Gnus will
3186 prompt the user for the name of an NNTP server to use.
3187 As opposed to `gnus', this command will not connect to the local server."
3188   (interactive "P")
3189   (gnus-no-server-1 arg slave))
3190
3191 ;;;###autoload
3192 (defun gnus-slave (&optional arg)
3193   "Read news as a slave."
3194   (interactive "P")
3195   (gnus arg nil 'slave))
3196
3197 (defcustom gnus-frame-properties nil
3198   "The properties of the frame in which gnus is displayed. Under XEmacs,
3199 the variable `toolbar-news-frame-plist' will be refered instead."
3200   :type '(repeat (cons :format "%v"
3201                        (symbol :tag "Parameter")
3202                        (sexp :tag "Value")))
3203   :group 'gnus)
3204
3205 (defvar gnus-frame nil
3206   "The frame in which gnus is displayed. It is not used under XEmacs.")
3207
3208 ;;;###autoload
3209 (defun gnus-other-frame (&optional arg)
3210   "Pop up a frame to read news."
3211   (interactive "P")
3212   (static-if (featurep 'xemacs)
3213       (let ((toolbar-news-use-separate-frame t))
3214         (toolbar-gnus))
3215     (if (frame-live-p gnus-frame)
3216         (raise-frame gnus-frame)
3217       (setq gnus-frame (make-frame gnus-frame-properties))
3218       (if (and (gnus-buffer-live-p gnus-group-buffer)
3219                (save-current-buffer
3220                  (set-buffer gnus-group-buffer)
3221                  (eq 'gnus-group-mode major-mode)))
3222           (progn
3223             (select-frame gnus-frame)
3224             (switch-to-buffer gnus-group-buffer))
3225         (add-hook 'gnus-exit-gnus-hook
3226                   (lambda ()
3227                     (when (and (frame-live-p gnus-frame)
3228                                (cdr (frame-list)))
3229                       (delete-frame gnus-frame))
3230                     (setq gnus-frame nil)))
3231         (select-frame gnus-frame)
3232         (gnus arg)))))
3233
3234 ;;;###autoload
3235 (defun gnus (&optional arg dont-connect slave)
3236   "Read network news.
3237 If ARG is non-nil and a positive number, Gnus will use that as the
3238 startup level.  If ARG is non-nil and not a positive number, Gnus will
3239 prompt the user for the name of an NNTP server to use."
3240   (interactive "P")
3241   (gnus-1 arg dont-connect slave))
3242
3243 ;; Allow redefinition of Gnus functions.
3244
3245 (gnus-ems-redefine)
3246
3247 (product-provide (provide 'gnus) 'gnus-vers)
3248
3249 ;;; gnus.el ends here