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