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