*** empty log message ***
[gnus] / lisp / gnus.el
1 ;;; gnus.el --- a newsreader for GNU Emacs
2 ;; Copyright (C) 1987,88,89,90,93,94,95,96 Free Software Foundation, Inc.
3
4 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
5 ;;      Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
6 ;; Keywords: news
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Commentary:
26
27 ;;; Code:
28
29 (eval '(run-hooks 'gnus-load-hook))
30
31 (require 'custom)
32
33 (defgroup gnus nil
34   "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
35   :group 'emacs)
36
37 (defgroup gnus-start nil
38   "Starting your favorite newsreader."
39   :group 'gnus)
40
41 (defgroup gnus-score nil
42   "Score and kill file handling."
43   :group 'gnus )
44
45 (defconst gnus-version-number "0.53"
46   "Version number for this version of Gnus.")
47
48 (defconst gnus-version (format "Red Gnus v%s" gnus-version-number)
49   "Version string for this version of Gnus.")
50
51 (defcustom gnus-inhibit-startup-message nil
52   "*If non-nil, the startup message will not be displayed.
53 This variable is used before `.gnus.el' is loaded, so it should
54 be set in `.emacs' instead."
55   :group 'gnus-start
56   :type 'boolean)
57
58 (defcustom gnus-play-startup-jingle nil
59   "If non-nil, play the Gnus jingle at startup."
60   :group 'gnus-start
61   :type 'boolean)
62
63 ;;; Kludges to help the transition from the old `custom.el'.
64
65 ;; XEmacs and Emacs 19.29 facep does different things.
66 (defalias 'custom-facep
67   (cond ((fboundp 'find-face)
68          'find-face)
69         ((fboundp 'facep)
70          'facep)
71         (t
72          'ignore)))
73
74 (defalias 'gnus-make-overlay 'make-overlay)
75 (defalias 'gnus-overlay-put 'overlay-put)
76 (defalias 'gnus-move-overlay 'move-overlay)
77 (defalias 'gnus-overlay-end 'overlay-end)
78 (defalias 'gnus-extent-detached-p 'ignore)
79 (defalias 'gnus-extent-start-open 'ignore)
80 (defalias 'gnus-set-text-properties 'set-text-properties)
81 (defalias 'gnus-group-remove-excess-properties 'ignore)
82 (defalias 'gnus-topic-remove-excess-properties 'ignore)
83 (defalias 'gnus-appt-select-lowest-window 'appt-select-lowest-window)
84 (defalias 'gnus-mail-strip-quoted-names 'mail-strip-quoted-names)
85 (defalias 'gnus-make-local-hook 'make-local-hook)
86 (defalias 'gnus-add-hook 'add-hook)
87 (defalias 'gnus-character-to-event 'identity)
88 (defalias 'gnus-add-text-properties 'add-text-properties)
89 (defalias 'gnus-put-text-property 'put-text-property)
90 (defalias 'gnus-mode-line-buffer-identification 'identity)
91
92 ;; The XEmacs people think this is evil, so it must go.
93 (defun custom-face-lookup (&optional fg bg stipple bold italic underline)
94   "Lookup or create a face with specified attributes."
95   (let ((name (intern (format "custom-face-%s-%s-%s-%S-%S-%S"
96                               (or fg "default")
97                               (or bg "default")
98                               (or stipple "default")
99                               bold italic underline))))
100     (if (and (custom-facep name)
101              (fboundp 'make-face))
102         ()
103       (copy-face 'default name)
104       (when (and fg
105                  (not (string-equal fg "default")))
106         (condition-case ()
107             (set-face-foreground name fg)
108           (error nil)))
109       (when (and bg
110                  (not (string-equal bg "default")))
111         (condition-case ()
112             (set-face-background name bg)
113           (error nil)))
114       (when (and stipple
115                  (not (string-equal stipple "default"))
116                  (not (eq stipple 'custom:asis))
117                  (fboundp 'set-face-stipple))
118         (set-face-stipple name stipple))
119       (when (and bold
120                  (not (eq bold 'custom:asis)))
121         (condition-case ()
122             (make-face-bold name)
123           (error nil)))
124       (when (and italic
125                  (not (eq italic 'custom:asis)))
126         (condition-case ()
127             (make-face-italic name)
128           (error nil)))
129       (when (and underline
130                  (not (eq underline 'custom:asis)))
131         (condition-case ()
132             (set-face-underline-p name t)
133           (error nil))))
134     name))
135
136 ;;; Internal variables
137
138 (defvar gnus-group-buffer "*Group*")
139
140 (eval-and-compile
141   (autoload 'gnus-play-jingle "gnus-audio"))
142
143 ;;; Splash screen.
144
145 (defface gnus-splash-face 
146   '((((class color)
147       (background dark))
148      (:foreground "red"))
149     (((class color)
150       (background light))
151      (:foreground "red"))
152     (t
153      ()))
154   "Level 1 newsgroup face.")
155
156 (defun gnus-splash ()
157   (save-excursion
158     (switch-to-buffer gnus-group-buffer)
159     (let ((buffer-read-only nil))
160       (erase-buffer)
161       (unless gnus-inhibit-startup-message
162         (gnus-group-startup-message)
163         (sit-for 0)
164         (when gnus-play-startup-jingle
165           (gnus-play-jingle))))))
166
167 (defun gnus-indent-rigidly (start end arg)
168   "Indent rigidly using only spaces and no tabs."
169   (save-excursion
170     (save-restriction
171       (narrow-to-region start end)
172       (indent-rigidly start end arg)
173       ;; We translate tabs into spaces -- not everybody uses
174       ;; an 8-character tab.
175       (goto-char (point-min))
176       (while (search-forward "\t" nil t)
177         (replace-match "        " t t)))))
178
179 (defun gnus-group-startup-message (&optional x y)
180   "Insert startup message in current buffer."
181   ;; Insert the message.
182   (erase-buffer)
183   (insert
184    (format "              %s
185           _    ___ _             _
186           _ ___ __ ___  __    _ ___
187           __   _     ___    __  ___
188               _           ___     _
189              _  _ __             _
190              ___   __            _
191                    __           _
192                     _      _   _
193                    _      _    _
194                       _  _    _
195                   __  ___
196                  _   _ _     _
197                 _   _
198               _    _
199              _    _
200             _
201           __
202
203 "
204            ""))
205   ;; And then hack it.
206   (gnus-indent-rigidly (point-min) (point-max)
207                        (/ (max (- (window-width) (or x 46)) 0) 2))
208   (goto-char (point-min))
209   (forward-line 1)
210   (let* ((pheight (count-lines (point-min) (point-max)))
211          (wheight (window-height))
212          (rest (- wheight pheight)))
213     (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
214   ;; Fontify some.
215   (put-text-property (point-min) (point-max) 'face 'gnus-splash-face)
216   (goto-char (point-min))
217   (setq mode-line-buffer-identification gnus-version)
218   (set-buffer-modified-p t))
219
220 (eval-when (load)
221   (let ((command (format "%s" this-command)))
222     (when (and (string-match "gnus" command)
223                (not (string-match "gnus-other-frame" command)))
224       (gnus-splash))))
225
226 ;;; Do the rest.
227
228 (require 'custom)
229 (require 'gnus-util)
230 (require 'nnheader)
231
232 (defcustom gnus-directory (or (getenv "SAVEDIR") "~/News/")
233   "*Directory variable from which all other Gnus file variables are derived."
234   :group 'gnus-start
235   :type 'directory)
236
237 (defcustom gnus-default-directory nil
238   "*Default directory for all Gnus buffers."
239   :group 'gnus-start
240   :type 'directory)
241
242 ;; Site dependent variables.  These variables should be defined in
243 ;; paths.el.
244
245 (defvar gnus-default-nntp-server nil
246   "Specify a default NNTP server.
247 This variable should be defined in paths.el, and should never be set
248 by the user.
249 If you want to change servers, you should use `gnus-select-method'.
250 See the documentation to that variable.")
251
252 ;; Don't touch this variable.
253 (defvar gnus-nntp-service "nntp"
254   "*NNTP service name (\"nntp\" or 119).
255 This is an obsolete variable, which is scarcely used.  If you use an
256 nntp server for your newsgroup and want to change the port number
257 used to 899, you would say something along these lines:
258
259  (setq gnus-select-method '(nntp \"my.nntp.server\" (nntp-port-number 899)))")
260
261 (defvar gnus-nntpserver-file "/etc/nntpserver"
262   "*A file with only the name of the nntp server in it.")
263
264 ;; This function is used to check both the environment variable
265 ;; NNTPSERVER and the /etc/nntpserver file to see whether one can find
266 ;; an nntp server name default.
267 (defun gnus-getenv-nntpserver ()
268   (or (getenv "NNTPSERVER")
269       (and (file-readable-p gnus-nntpserver-file)
270            (save-excursion
271              (set-buffer (get-buffer-create " *gnus nntp*"))
272              (buffer-disable-undo (current-buffer))
273              (insert-file-contents gnus-nntpserver-file)
274              (let ((name (buffer-string)))
275                (prog1
276                    (if (string-match "^[ \t\n]*$" name)
277                        nil
278                      name)
279                  (kill-buffer (current-buffer))))))))
280
281 (defcustom gnus-select-method
282   (nconc
283    (list 'nntp (or (condition-case ()
284                        (gnus-getenv-nntpserver)
285                      (error nil))
286                    (when (and gnus-default-nntp-server
287                               (not (string= gnus-default-nntp-server "")))
288                      gnus-default-nntp-server)
289                    (system-name)))
290    (if (or (null gnus-nntp-service)
291            (equal gnus-nntp-service "nntp"))
292        nil
293      (list gnus-nntp-service)))
294   "*Default method for selecting a newsgroup.
295 This variable should be a list, where the first element is how the
296 news is to be fetched, the second is the address.
297
298 For instance, if you want to get your news via NNTP from
299 \"flab.flab.edu\", you could say:
300
301 (setq gnus-select-method '(nntp \"flab.flab.edu\"))
302
303 If you want to use your local spool, say:
304
305 (setq gnus-select-method (list 'nnspool (system-name)))
306
307 If you use this variable, you must set `gnus-nntp-server' to nil.
308
309 There is a lot more to know about select methods and virtual servers -
310 see the manual for details.")
311
312 (defvar gnus-message-archive-method 
313   `(nnfolder
314     "archive"
315     (nnfolder-directory ,(nnheader-concat message-directory "archive"))
316     (nnfolder-active-file 
317      ,(nnheader-concat message-directory "archive/active"))
318     (nnfolder-get-new-mail nil)
319     (nnfolder-inhibit-expiry t))
320   "*Method used for archiving messages you've sent.
321 This should be a mail method.
322
323 It's probably not a very effective to change this variable once you've
324 run Gnus once.  After doing that, you must edit this server from the
325 server buffer.")
326
327 (defvar gnus-message-archive-group nil
328   "*Name of the group in which to save the messages you've written.
329 This can either be a string, a list of strings; or an alist
330 of regexps/functions/forms to be evaluated to return a string (or a list
331 of strings).  The functions are called with the name of the current
332 group (or nil) as a parameter.
333
334 If you want to save your mail in one group and the news articles you
335 write in another group, you could say something like:
336
337  \(setq gnus-message-archive-group 
338         '((if (message-news-p)
339               \"misc-news\" 
340             \"misc-mail\")))
341
342 Normally the group names returned by this variable should be
343 unprefixed -- which implicitly means \"store on the archive server\".
344 However, you may wish to store the message on some other server.  In
345 that case, just return a fully prefixed name of the group --
346 \"nnml+private:mail.misc\", for instance.")
347
348 (defvar gnus-secondary-servers nil
349   "*List of NNTP servers that the user can choose between interactively.
350 To make Gnus query you for a server, you have to give `gnus' a
351 non-numeric prefix - `C-u M-x gnus', in short.")
352
353 (defvar gnus-nntp-server nil
354   "*The name of the host running the NNTP server.
355 This variable is semi-obsolete.  Use the `gnus-select-method'
356 variable instead.")
357
358 (defvar gnus-secondary-select-methods nil
359   "*A list of secondary methods that will be used for reading news.
360 This is a list where each element is a complete select method (see
361 `gnus-select-method').
362
363 If, for instance, you want to read your mail with the nnml backend,
364 you could set this variable:
365
366 (setq gnus-secondary-select-methods '((nnml \"\")))")
367
368 (defvar gnus-backup-default-subscribed-newsgroups
369   '("news.announce.newusers" "news.groups.questions" "gnu.emacs.gnus")
370   "Default default new newsgroups the first time Gnus is run.
371 Should be set in paths.el, and shouldn't be touched by the user.")
372
373 (defvar gnus-local-domain nil
374   "Local domain name without a host name.
375 The DOMAINNAME environment variable is used instead if it is defined.
376 If the `system-name' function returns the full Internet name, there is
377 no need to set this variable.")
378
379 (defvar gnus-local-organization nil
380   "String with a description of what organization (if any) the user belongs to.
381 The ORGANIZATION environment variable is used instead if it is defined.
382 If this variable contains a function, this function will be called
383 with the current newsgroup name as the argument.  The function should
384 return a string.
385
386 In any case, if the string (either in the variable, in the environment
387 variable, or returned by the function) is a file name, the contents of
388 this file will be used as the organization.")
389
390 ;; Customization variables
391
392 (defvar gnus-refer-article-method nil
393   "*Preferred method for fetching an article by Message-ID.
394 If you are reading news from the local spool (with nnspool), fetching
395 articles by Message-ID is painfully slow.  By setting this method to an
396 nntp method, you might get acceptable results.
397
398 The value of this variable must be a valid select method as discussed
399 in the documentation of `gnus-select-method'.")
400
401 (defvar gnus-group-faq-directory
402   '("/ftp@mirrors.aol.com:/pub/rtfm/usenet/"
403     "/ftp@sunsite.auc.dk:/pub/usenet/"
404     "/ftp@sunsite.doc.ic.ac.uk:/pub/usenet/news-faqs/"
405     "/ftp@src.doc.ic.ac.uk:/usenet/news-FAQS/"
406     "/ftp@ftp.seas.gwu.edu:/pub/rtfm/"
407     "/ftp@rtfm.mit.edu:/pub/usenet/"
408     "/ftp@ftp.uni-paderborn.de:/pub/FAQ/"
409     "/ftp@ftp.sunet.se:/pub/usenet/"
410     "/ftp@nctuccca.edu.tw:/USENET/FAQ/"
411     "/ftp@hwarang.postech.ac.kr:/pub/usenet/"
412     "/ftp@ftp.hk.super.net:/mirror/faqs/")
413   "*Directory where the group FAQs are stored.
414 This will most commonly be on a remote machine, and the file will be
415 fetched by ange-ftp.
416
417 This variable can also be a list of directories.  In that case, the
418 first element in the list will be used by default.  The others can
419 be used when being prompted for a site.
420
421 Note that Gnus uses an aol machine as the default directory.  If this
422 feels fundamentally unclean, just think of it as a way to finally get
423 something of value back from them.
424
425 If the default site is too slow, try one of these:
426
427    North America: mirrors.aol.com                /pub/rtfm/usenet
428                   ftp.seas.gwu.edu               /pub/rtfm
429                   rtfm.mit.edu                   /pub/usenet
430    Europe:        ftp.uni-paderborn.de           /pub/FAQ
431                   src.doc.ic.ac.uk               /usenet/news-FAQS
432                   ftp.sunet.se                   /pub/usenet
433                   sunsite.auc.dk                 /pub/usenet
434    Asia:          nctuccca.edu.tw                /USENET/FAQ
435                   hwarang.postech.ac.kr          /pub/usenet
436                   ftp.hk.super.net               /mirror/faqs")
437
438 (defvar gnus-use-cross-reference t
439   "*Non-nil means that cross referenced articles will be marked as read.
440 If nil, ignore cross references.  If t, mark articles as read in
441 subscribed newsgroups.  If neither t nor nil, mark as read in all
442 newsgroups.")
443
444 (defvar gnus-process-mark ?#
445   "*Process mark.")
446
447 (defvar gnus-asynchronous nil
448   "*If non-nil, Gnus will supply backends with data needed for async article fetching.")
449
450 (defvar gnus-large-newsgroup 200
451   "*The number of articles which indicates a large newsgroup.
452 If the number of articles in a newsgroup is greater than this value,
453 confirmation is required for selecting the newsgroup.")
454
455 (defvar gnus-use-long-file-name (not (memq system-type '(usg-unix-v xenix)))
456   "*Non-nil means that the default name of a file to save articles in is the group name.
457 If it's nil, the directory form of the group name is used instead.
458
459 If this variable is a list, and the list contains the element
460 `not-score', long file names will not be used for score files; if it
461 contains the element `not-save', long file names will not be used for
462 saving; and if it contains the element `not-kill', long file names
463 will not be used for kill files.
464
465 Note that the default for this variable varies according to what system
466 type you're using.  On `usg-unix-v' and `xenix' this variable defaults
467 to nil while on all other systems it defaults to t.")
468
469 (defvar gnus-kill-files-directory gnus-directory
470   "*Name of the directory where kill files will be stored (default \"~/News\").")
471
472 (defvar gnus-save-score nil
473   "*If non-nil, save group scoring info.")
474
475 (defvar gnus-use-undo t
476   "*If non-nil, allow undoing in Gnus group mode buffers.")
477
478 (defvar gnus-use-adaptive-scoring nil
479   "*If non-nil, use some adaptive scoring scheme.
480 If a list, then the values `word' and `line' are meaningful.  The
481 former will perform adaption on individual words in the subject
482 header while `line' will perform adaption on several headers.")
483
484 (defvar gnus-use-cache 'passive
485   "*If nil, Gnus will ignore the article cache.
486 If `passive', it will allow entering (and reading) articles
487 explicitly entered into the cache.  If anything else, use the
488 cache to the full extent of the law.")
489
490 (defvar gnus-use-trees nil
491   "*If non-nil, display a thread tree buffer.")
492
493 (defvar gnus-use-grouplens nil
494   "*If non-nil, use GroupLens ratings.")
495
496 (defvar gnus-keep-backlog nil
497   "*If non-nil, Gnus will keep read articles for later re-retrieval.
498 If it is a number N, then Gnus will only keep the last N articles
499 read.  If it is neither nil nor a number, Gnus will keep all read
500 articles.  This is not a good idea.")
501
502 (defvar gnus-use-nocem nil
503   "*If non-nil, Gnus will read NoCeM cancel messages.")
504
505 (defvar gnus-suppress-duplicates nil
506   "*If non-nil, Gnus will mark duplicate copies of the same article as read.")
507
508 (defvar gnus-use-demon nil
509   "If non-nil, Gnus might use some demons.")
510
511 (defvar gnus-use-scoring t
512   "*If non-nil, enable scoring.")
513
514 (defvar gnus-use-picons nil
515   "*If non-nil, display picons.")
516
517 (defvar gnus-summary-prepare-exit-hook nil
518   "*A hook called when preparing to exit from the summary buffer.
519 It calls `gnus-summary-expire-articles' by default.")
520 (add-hook 'gnus-summary-prepare-exit-hook 'gnus-summary-expire-articles)
521
522 (defvar gnus-novice-user t
523   "*Non-nil means that you are a usenet novice.
524 If non-nil, verbose messages may be displayed and confirmations may be
525 required.")
526
527 (defvar gnus-expert-user nil
528   "*Non-nil means that you will never be asked for confirmation about anything.
529 And that means *anything*.")
530
531 (defvar gnus-interactive-catchup t
532   "*If non-nil, require your confirmation when catching up a group.")
533
534 (defvar gnus-interactive-exit t
535   "*If non-nil, require your confirmation when exiting Gnus.")
536
537 (defvar gnus-extract-address-components 'gnus-extract-address-components
538   "*Function for extracting address components from a From header.
539 Two pre-defined function exist: `gnus-extract-address-components',
540 which is the default, quite fast, and too simplistic solution, and
541 `mail-extract-address-components', which works much better, but is
542 slower.")
543
544 (defvar gnus-carpal nil
545   "*If non-nil, display clickable icons.")
546
547 (defvar gnus-shell-command-separator ";"
548   "String used to separate to shell commands.")
549
550 (defvar gnus-valid-select-methods
551   '(("nntp" post address prompt-address)
552     ("nnspool" post address)
553     ("nnvirtual" post-mail virtual prompt-address)
554     ("nnmbox" mail respool address)
555     ("nnml" mail respool address)
556     ("nnmh" mail respool address)
557     ("nndir" post-mail prompt-address)
558     ("nneething" none address prompt-address)
559     ("nndoc" none address prompt-address)
560     ("nnbabyl" mail address respool)
561     ("nnkiboze" post virtual)
562     ("nnsoup" post-mail address)
563     ("nndraft" post-mail)
564     ("nnfolder" mail respool address)
565     ("nngateway" none address prompt-address)
566     ("nnweb" none))
567   "An alist of valid select methods.
568 The first element of each list lists should be a string with the name
569 of the select method.  The other elements may be the category of
570 this method (i. e., `post', `mail', `none' or whatever) or other
571 properties that this method has (like being respoolable).
572 If you implement a new select method, all you should have to change is
573 this variable.  I think.")
574
575 (defvar gnus-updated-mode-lines '(group article summary tree)
576   "*List of buffers that should update their mode lines.
577 The list may contain the symbols `group', `article' and `summary'.  If
578 the corresponding symbol is present, Gnus will keep that mode line
579 updated with information that may be pertinent.
580 If this variable is nil, screen refresh may be quicker.")
581
582 ;; Added by Keinonen Kari <kk85613@cs.tut.fi>.
583 (defvar gnus-mode-non-string-length nil
584   "*Max length of mode-line non-string contents.
585 If this is nil, Gnus will take space as is needed, leaving the rest
586 of the modeline intact.")
587
588 (defvar gnus-auto-expirable-newsgroups nil
589   "*Groups in which to automatically mark read articles as expirable.
590 If non-nil, this should be a regexp that should match all groups in
591 which to perform auto-expiry.  This only makes sense for mail groups.")
592
593 (defvar gnus-total-expirable-newsgroups nil
594   "*Groups in which to perform expiry of all read articles.
595 Use with extreme caution.  All groups that match this regexp will be
596 expiring - which means that all read articles will be deleted after
597 (say) one week.  (This only goes for mail groups and the like, of
598 course.)")
599
600 (defvar gnus-group-uncollapsed-levels 1
601   "Number of group name elements to leave alone when making a short group name.")
602
603 (defvar gnus-group-use-permanent-levels nil
604   "*If non-nil, once you set a level, Gnus will use this level.")
605
606 ;; Hooks.
607
608 (defvar gnus-load-hook nil
609   "*A hook run while Gnus is loaded.")
610
611 (defvar gnus-apply-kill-hook '(gnus-apply-kill-file)
612   "*A hook called to apply kill files to a group.
613 This hook is intended to apply a kill file to the selected newsgroup.
614 The function `gnus-apply-kill-file' is called by default.
615
616 Since a general kill file is too heavy to use only for a few
617 newsgroups, I recommend you to use a lighter hook function.  For
618 example, if you'd like to apply a kill file to articles which contains
619 a string `rmgroup' in subject in newsgroup `control', you can use the
620 following hook:
621
622  (setq gnus-apply-kill-hook
623       (list
624         (lambda ()
625           (cond ((string-match \"control\" gnus-newsgroup-name)
626                  (gnus-kill \"Subject\" \"rmgroup\")
627                  (gnus-expunge \"X\"))))))")
628
629 (defvar gnus-group-change-level-function nil
630   "Function run when a group level is changed.
631 It is called with three parameters -- GROUP, LEVEL and OLDLEVEL.")
632
633 ;;; Face thingies.
634
635 (defvar gnus-visual 
636   '(summary-highlight group-highlight article-highlight 
637                       mouse-face
638                       summary-menu group-menu article-menu
639                       tree-highlight menu highlight
640                       browse-menu server-menu
641                       page-marker tree-menu binary-menu pick-menu
642                       grouplens-menu)
643   "Enable visual features.
644 If `visual' is disabled, there will be no menus and few faces.  Most of
645 the visual customization options below will be ignored.  Gnus will use
646 less space and be faster as a result.")
647
648 (defvar gnus-mouse-face
649   (condition-case ()
650       (if (gnus-visual-p 'mouse-face 'highlight)
651           (if (boundp 'gnus-mouse-face)
652               (or gnus-mouse-face 'highlight)
653             'highlight)
654         'default)
655     (error 'highlight))
656   "Face used for group or summary buffer mouse highlighting.
657 The line beneath the mouse pointer will be highlighted with this
658 face.")
659
660 (defvar gnus-article-display-hook
661   (if (and (string-match "XEmacs" emacs-version)
662            (featurep 'xface))
663       '(gnus-article-hide-headers-if-wanted
664         gnus-article-hide-boring-headers
665         gnus-article-treat-overstrike
666         gnus-article-maybe-highlight
667         gnus-article-display-x-face)
668     '(gnus-article-hide-headers-if-wanted
669       gnus-article-hide-boring-headers
670       gnus-article-treat-overstrike
671       gnus-article-maybe-highlight))
672   "Controls how the article buffer will look.
673
674 If you leave the list empty, the article will appear exactly as it is
675 stored on the disk.  The list entries will hide or highlight various
676 parts of the article, making it easier to find the information you
677 want.")
678
679
680
681 \f
682 ;;; Internal variables
683
684 (defvar gnus-group-get-parameter-function 'gnus-group-get-parameter)
685 (defvar gnus-original-article-buffer " *Original Article*")
686 (defvar gnus-newsgroup-name nil)
687
688 (defvar gnus-current-select-method nil
689   "The current method for selecting a newsgroup.")
690
691 (defvar gnus-tree-buffer "*Tree*"
692   "Buffer where Gnus thread trees are displayed.")
693
694 ;; Dummy variable.
695 (defvar gnus-use-generic-from nil)
696
697 ;; Variable holding the user answers to all method prompts.
698 (defvar gnus-method-history nil)
699
700 ;; Variable holding the user answers to all mail method prompts.
701 (defvar gnus-mail-method-history nil)
702
703 ;; Variable holding the user answers to all group prompts.
704 (defvar gnus-group-history nil)
705
706 (defvar gnus-server-alist nil
707   "List of available servers.")
708
709 (defvar gnus-predefined-server-alist
710   `(("cache"
711      (nnspool "cache"
712               (nnspool-spool-directory "~/News/cache/")
713               (nnspool-nov-directory "~/News/cache/")
714               (nnspool-active-file "~/News/cache/active"))))
715   "List of predefined (convenience) servers.")
716
717 (defvar gnus-topic-indentation "") ;; Obsolete variable.
718
719 (defconst gnus-article-mark-lists
720   '((marked . tick) (replied . reply)
721     (expirable . expire) (killed . killed)
722     (bookmarks . bookmark) (dormant . dormant)
723     (scored . score) (saved . save)
724     (cached . cache)))
725
726 (defvar gnus-headers-retrieved-by nil)
727 (defvar gnus-article-reply nil)
728 (defvar gnus-override-method nil)
729 (defvar gnus-article-check-size nil)
730 (defvar gnus-opened-servers nil)
731
732 (defvar gnus-current-kill-article nil)
733
734 (defvar gnus-have-read-active-file nil)
735
736 (defconst gnus-maintainer
737   "gnus-bug@ifi.uio.no (The Gnus Bugfixing Girls + Boys)"
738   "The mail address of the Gnus maintainers.")
739
740 (defvar gnus-info-nodes
741   '((gnus-group-mode "(gnus)The Group Buffer")
742     (gnus-summary-mode "(gnus)The Summary Buffer")
743     (gnus-article-mode "(gnus)The Article Buffer")
744     (mime/viewer-mode "(gnus)The Article Buffer")
745     (gnus-server-mode "(gnus)The Server Buffer")
746     (gnus-browse-mode "(gnus)Browse Foreign Server")
747     (gnus-tree-mode "(gnus)Tree Display"))
748   "Alist of major modes and related Info nodes.")
749
750 (defvar gnus-group-buffer "*Group*")
751 (defvar gnus-summary-buffer "*Summary*")
752 (defvar gnus-article-buffer "*Article*")
753 (defvar gnus-server-buffer "*Server*")
754
755 (defvar gnus-buffer-list nil
756   "Gnus buffers that should be killed on exit.")
757
758 (defvar gnus-slave nil
759   "Whether this Gnus is a slave or not.")
760
761 (defvar gnus-variable-list
762   '(gnus-newsrc-options gnus-newsrc-options-n
763     gnus-newsrc-last-checked-date
764     gnus-newsrc-alist gnus-server-alist
765     gnus-killed-list gnus-zombie-list
766     gnus-topic-topology gnus-topic-alist
767     gnus-format-specs)
768   "Gnus variables saved in the quick startup file.")
769
770 (defvar gnus-newsrc-alist nil
771   "Assoc list of read articles.
772 gnus-newsrc-hashtb should be kept so that both hold the same information.")
773
774 (defvar gnus-newsrc-hashtb nil
775   "Hashtable of gnus-newsrc-alist.")
776
777 (defvar gnus-killed-list nil
778   "List of killed newsgroups.")
779
780 (defvar gnus-killed-hashtb nil
781   "Hash table equivalent of gnus-killed-list.")
782
783 (defvar gnus-zombie-list nil
784   "List of almost dead newsgroups.")
785
786 (defvar gnus-description-hashtb nil
787   "Descriptions of newsgroups.")
788
789 (defvar gnus-list-of-killed-groups nil
790   "List of newsgroups that have recently been killed by the user.")
791
792 (defvar gnus-active-hashtb nil
793   "Hashtable of active articles.")
794
795 (defvar gnus-moderated-list nil
796   "List of moderated newsgroups.")
797
798 ;; Save window configuration.
799 (defvar gnus-prev-winconf nil)
800
801 (defvar gnus-reffed-article-number nil)
802
803 ;;; Let the byte-compiler know that we know about this variable.
804 (defvar rmail-default-rmail-file)
805
806 (defvar gnus-dead-summary nil)
807
808 ;;; End of variables.
809
810 ;; Define some autoload functions Gnus might use.
811 (eval-and-compile
812
813   ;; This little mapcar goes through the list below and marks the
814   ;; symbols in question as autoloaded functions.
815   (mapcar
816    (lambda (package)
817      (let ((interactive (nth 1 (memq ':interactive package))))
818        (mapcar
819         (lambda (function)
820           (let (keymap)
821             (when (consp function)
822               (setq keymap (car (memq 'keymap function)))
823               (setq function (car function)))
824             (autoload function (car package) nil interactive keymap)))
825         (if (eq (nth 1 package) ':interactive)
826             (cdddr package)
827           (cdr package)))))
828    '(("metamail" metamail-buffer)
829      ("info" Info-goto-node)
830      ("hexl" hexl-hex-string-to-integer)
831      ("pp" pp pp-to-string pp-eval-expression)
832      ("mail-extr" mail-extract-address-components)
833      ("message" :interactive t
834       message-send-and-exit message-yank-original)
835      ("nnmail" nnmail-split-fancy nnmail-article-group nnmail-date-to-time)
836      ("nnvirtual" nnvirtual-catchup-group nnvirtual-convert-headers)
837      ("timezone" timezone-make-date-arpa-standard timezone-fix-time
838       timezone-make-sortable-date timezone-make-time-string)
839      ("rmailout" rmail-output)
840      ("rmail" rmail-insert-rmail-file-header rmail-count-new-messages
841       rmail-show-message)
842      ("gnus-xmas" gnus-xmas-splash)
843      ("gnus-soup" :interactive t
844       gnus-group-brew-soup gnus-brew-soup gnus-soup-add-article
845       gnus-soup-send-replies gnus-soup-save-areas gnus-soup-pack-packet)
846      ("nnsoup" nnsoup-pack-replies)
847      ("score-mode" :interactive t gnus-score-mode)
848      ("gnus-mh" gnus-summary-save-article-folder
849       gnus-Folder-save-name gnus-folder-save-name)
850      ("gnus-mh" :interactive t gnus-summary-save-in-folder)
851      ("gnus-demon" gnus-demon-add-nocem gnus-demon-add-scanmail
852       gnus-demon-add-disconnection gnus-demon-add-handler
853       gnus-demon-remove-handler)
854      ("gnus-demon" :interactive t
855       gnus-demon-init gnus-demon-cancel)
856      ("gnus-salt" gnus-highlight-selected-tree gnus-possibly-generate-tree
857       gnus-tree-open gnus-tree-close gnus-carpal-setup-buffer)
858      ("gnus-nocem" gnus-nocem-scan-groups gnus-nocem-close
859       gnus-nocem-unwanted-article-p)
860      ("gnus-srvr" gnus-enter-server-buffer gnus-server-set-info)
861      ("gnus-srvr" gnus-browse-foreign-server)
862      ("gnus-cite" :interactive t
863       gnus-article-highlight-citation gnus-article-hide-citation-maybe
864       gnus-article-hide-citation gnus-article-fill-cited-article
865       gnus-article-hide-citation-in-followups)
866      ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
867       gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
868       gnus-execute gnus-expunge)
869      ("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
870       gnus-cache-possibly-remove-articles gnus-cache-request-article
871       gnus-cache-retrieve-headers gnus-cache-possibly-alter-active
872       gnus-cache-enter-remove-article gnus-cached-article-p
873       gnus-cache-open gnus-cache-close gnus-cache-update-article)
874       ("gnus-cache" :interactive t gnus-jog-cache gnus-cache-enter-article
875        gnus-cache-remove-article gnus-summary-insert-cached-articles)
876       ("gnus-score" :interactive t
877        gnus-summary-increase-score gnus-summary-set-score
878        gnus-summary-raise-thread gnus-summary-raise-same-subject
879        gnus-summary-raise-score gnus-summary-raise-same-subject-and-select
880        gnus-summary-lower-thread gnus-summary-lower-same-subject
881        gnus-summary-lower-score gnus-summary-lower-same-subject-and-select
882        gnus-summary-current-score gnus-score-default
883        gnus-score-flush-cache gnus-score-close
884        gnus-possibly-score-headers gnus-score-followup-article
885        gnus-score-followup-thread)
886       ("gnus-score"
887        (gnus-summary-score-map keymap) gnus-score-save gnus-score-headers
888       gnus-current-score-file-nondirectory gnus-score-adaptive
889       gnus-score-find-trace gnus-score-file-name)
890      ("gnus-cus" :interactive t gnus-group-customize gnus-score-customize)
891      ("gnus-topic" :interactive t gnus-topic-mode)
892      ("gnus-topic" gnus-topic-remove-group)
893      ("gnus-salt" :interactive t gnus-pick-mode gnus-binary-mode)
894      ("gnus-uu" (gnus-uu-extract-map keymap) (gnus-uu-mark-map keymap))
895      ("gnus-uu" :interactive t
896       gnus-uu-digest-mail-forward gnus-uu-digest-post-forward
897       gnus-uu-mark-series gnus-uu-mark-region gnus-uu-mark-buffer
898       gnus-uu-mark-by-regexp gnus-uu-mark-all
899       gnus-uu-mark-sparse gnus-uu-mark-thread gnus-uu-decode-uu
900       gnus-uu-decode-uu-and-save gnus-uu-decode-unshar
901       gnus-uu-decode-unshar-and-save gnus-uu-decode-save
902       gnus-uu-decode-binhex gnus-uu-decode-uu-view
903       gnus-uu-decode-uu-and-save-view gnus-uu-decode-unshar-view
904       gnus-uu-decode-unshar-and-save-view gnus-uu-decode-save-view
905       gnus-uu-decode-binhex-view)
906      ("gnus-msg" (gnus-summary-send-map keymap)
907       gnus-article-mail gnus-copy-article-buffer gnus-extended-version)
908      ("gnus-msg" :interactive t
909       gnus-group-post-news gnus-group-mail gnus-summary-post-news
910       gnus-summary-followup gnus-summary-followup-with-original
911       gnus-summary-cancel-article gnus-summary-supersede-article
912       gnus-post-news gnus-summary-reply gnus-summary-reply-with-original
913       gnus-summary-mail-forward gnus-summary-mail-other-window
914       gnus-summary-resend-message gnus-summary-resend-bounced-mail
915       gnus-bug)
916      ("gnus-picon" :interactive t gnus-article-display-picons
917       gnus-group-display-picons gnus-picons-article-display-x-face
918       gnus-picons-display-x-face)
919      ("gnus-gl" bbb-login bbb-logout bbb-grouplens-group-p 
920       gnus-grouplens-mode)
921      ("smiley" :interactive t gnus-smiley-display)
922      ("gnus-win" gnus-configure-windows)
923      ("gnus-sum" gnus-summary-insert-line gnus-summary-read-group
924       gnus-list-of-unread-articles gnus-list-of-read-articles
925       gnus-offer-save-summaries gnus-make-thread-indent-array
926       gnus-summary-exit gnus-update-read-articles)
927      ("gnus-group" gnus-group-insert-group-line gnus-group-quit
928       gnus-group-list-groups gnus-group-first-unread-group
929       gnus-group-set-mode-line gnus-group-set-info gnus-group-save-newsrc
930       gnus-group-setup-buffer gnus-group-get-new-news
931       gnus-group-make-help-group gnus-group-update-group)
932      ("gnus-bcklg" gnus-backlog-request-article gnus-backlog-enter-article
933       gnus-backlog-remove-article)
934      ("gnus-art" gnus-article-read-summary-keys gnus-article-save
935       gnus-article-prepare gnus-article-set-window-start
936       gnus-article-next-page gnus-article-prev-page
937       gnus-request-article-this-buffer gnus-article-mode
938       gnus-article-setup-buffer gnus-narrow-to-page)
939      ("gnus-art" :interactive t
940       gnus-article-hide-headers gnus-article-hide-boring-headers
941       gnus-article-treat-overstrike gnus-article-word-wrap
942       gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
943       gnus-article-display-x-face gnus-article-de-quoted-unreadable
944       gnus-article-mime-decode-quoted-printable gnus-article-hide-pgp
945       gnus-article-hide-pem gnus-article-hide-signature
946       gnus-article-strip-leading-blank-lines gnus-article-date-local
947       gnus-article-date-original gnus-article-date-lapsed
948       gnus-decode-rfc1522 gnus-article-show-all-headers
949       gnus-article-edit-mode gnus-article-edit-article
950       gnus-article-edit-done)
951      ("gnus-int" gnus-request-type)
952      ("gnus-start" gnus-newsrc-parse-options gnus-1 gnus-no-server-1
953       gnus-dribble-enter)
954      ("gnus-dup" gnus-dup-suppress-articles gnus-dup-unsuppress-article
955       gnus-dup-enter-articles)
956      ("gnus-range" gnus-copy-sequence)
957      ("gnus-eform" gnus-edit-form)
958      ("gnus-move" :interactive t
959       gnus-group-move-group-to-server gnus-change-server)
960      ("gnus-logic" gnus-score-advanced)
961      ("gnus-undo" gnus-undo-mode gnus-undo-register)
962      ("gnus-async" gnus-async-request-fetched-article gnus-async-prefetch-next
963       gnus-async-prefetch-article gnus-async-prefetch-remove-group)
964      ("article" article-decode-rfc1522)
965      ("gnus-vm" :interactive t gnus-summary-save-in-vm
966       gnus-summary-save-article-vm))))
967
968 ;;; gnus-sum.el thingies
969
970
971 (defvar gnus-summary-line-format "%U\%R\%z\%I\%(%[%4L: %-20,20n%]%) %s\n"
972   "*The format specification of the lines in the summary buffer.
973
974 It works along the same lines as a normal formatting string,
975 with some simple extensions.
976
977 %N   Article number, left padded with spaces (string)
978 %S   Subject (string)
979 %s   Subject if it is at the root of a thread, and \"\" otherwise (string)
980 %n   Name of the poster (string)
981 %a   Extracted name of the poster (string)
982 %A   Extracted address of the poster (string)
983 %F   Contents of the From: header (string)
984 %x   Contents of the Xref: header (string)
985 %D   Date of the article (string)
986 %d   Date of the article (string) in DD-MMM format
987 %M   Message-id of the article (string)
988 %r   References of the article (string)
989 %c   Number of characters in the article (integer)
990 %L   Number of lines in the article (integer)
991 %I   Indentation based on thread level (a string of spaces)
992 %T   A string with two possible values: 80 spaces if the article
993      is on thread level two or larger and 0 spaces on level one
994 %R   \"A\" if this article has been replied to, \" \" otherwise (character)
995 %U   Status of this article (character, \"R\", \"K\", \"-\" or \" \")
996 %[   Opening bracket (character, \"[\" or \"<\")
997 %]   Closing bracket (character, \"]\" or \">\")
998 %>   Spaces of length thread-level (string)
999 %<   Spaces of length (- 20 thread-level) (string)
1000 %i   Article score (number)
1001 %z   Article zcore (character)
1002 %t   Number of articles under the current thread (number).
1003 %e   Whether the thread is empty or not (character).
1004 %l   GroupLens score (string).
1005 %P   The line number (number).
1006 %u   User defined specifier.  The next character in the format string should
1007      be a letter.  Gnus will call the function gnus-user-format-function-X,
1008      where X is the letter following %u.  The function will be passed the
1009      current header as argument.  The function should return a string, which
1010      will be inserted into the summary just like information from any other
1011      summary specifier.
1012
1013 Text between %( and %) will be highlighted with `gnus-mouse-face'
1014 when the mouse point is placed inside the area.  There can only be one
1015 such area.
1016
1017 The %U (status), %R (replied) and %z (zcore) specs have to be handled
1018 with care.  For reasons of efficiency, Gnus will compute what column
1019 these characters will end up in, and \"hard-code\" that.  This means that
1020 it is illegal to have these specs after a variable-length spec.  Well,
1021 you might not be arrested, but your summary buffer will look strange,
1022 which is bad enough.
1023
1024 The smart choice is to have these specs as for to the left as
1025 possible.
1026
1027 This restriction may disappear in later versions of Gnus.")
1028
1029 ;;;
1030 ;;; Skeleton keymaps
1031 ;;;
1032
1033 (defun gnus-suppress-keymap (keymap)
1034   (suppress-keymap keymap)
1035   (let ((keys `([delete] "\177" "\M-u"))) ;gnus-mouse-2 
1036     (while keys
1037       (define-key keymap (pop keys) 'undefined))))
1038
1039 (defvar gnus-article-mode-map (make-keymap))
1040 (gnus-suppress-keymap gnus-article-mode-map)
1041 (defvar gnus-summary-mode-map (make-keymap))
1042 (gnus-suppress-keymap gnus-summary-mode-map)
1043 (defvar gnus-group-mode-map (make-keymap))
1044 (gnus-suppress-keymap gnus-group-mode-map)
1045
1046 \f
1047
1048 ;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
1049 ;; If you want the cursor to go somewhere else, set these two
1050 ;; functions in some startup hook to whatever you want.
1051 (defalias 'gnus-summary-position-point 'gnus-goto-colon)
1052 (defalias 'gnus-group-position-point 'gnus-goto-colon)
1053
1054 ;;; Various macros and substs.
1055
1056 (defun gnus-header-from (header)
1057   (mail-header-from header))
1058
1059 (defmacro gnus-gethash (string hashtable)
1060   "Get hash value of STRING in HASHTABLE."
1061   `(symbol-value (intern-soft ,string ,hashtable)))
1062
1063 (defmacro gnus-sethash (string value hashtable)
1064   "Set hash value.  Arguments are STRING, VALUE, and HASHTABLE."
1065   `(set (intern ,string ,hashtable) ,value))
1066 (put 'gnus-sethash 'edebug-form-spec '(form form form))
1067
1068 (defmacro gnus-group-unread (group)
1069   "Get the currently computed number of unread articles in GROUP."
1070   `(car (gnus-gethash ,group gnus-newsrc-hashtb)))
1071
1072 (defmacro gnus-group-entry (group)
1073   "Get the newsrc entry for GROUP."
1074   `(gnus-gethash ,group gnus-newsrc-hashtb))
1075
1076 (defmacro gnus-active (group)
1077   "Get active info on GROUP."
1078   `(gnus-gethash ,group gnus-active-hashtb))
1079
1080 (defmacro gnus-set-active (group active)
1081   "Set GROUP's active info."
1082   `(gnus-sethash ,group ,active gnus-active-hashtb))
1083
1084 (defun gnus-alive-p ()
1085   "Say whether Gnus is running or not."
1086   (and gnus-group-buffer
1087        (get-buffer gnus-group-buffer)
1088        (save-excursion
1089          (set-buffer gnus-group-buffer)
1090          (eq major-mode 'gnus-group-mode))))
1091
1092 ;; Info access macros.
1093
1094 (defmacro gnus-info-group (info)
1095   `(nth 0 ,info))
1096 (defmacro gnus-info-rank (info)
1097   `(nth 1 ,info))
1098 (defmacro gnus-info-read (info)
1099   `(nth 2 ,info))
1100 (defmacro gnus-info-marks (info)
1101   `(nth 3 ,info))
1102 (defmacro gnus-info-method (info)
1103   `(nth 4 ,info))
1104 (defmacro gnus-info-params (info)
1105   `(nth 5 ,info))
1106
1107 (defmacro gnus-info-level (info)
1108   `(let ((rank (gnus-info-rank ,info)))
1109      (if (consp rank)
1110          (car rank)
1111        rank)))
1112 (defmacro gnus-info-score (info)
1113   `(let ((rank (gnus-info-rank ,info)))
1114      (or (and (consp rank) (cdr rank)) 0)))
1115
1116 (defmacro gnus-info-set-group (info group)
1117   `(setcar ,info ,group))
1118 (defmacro gnus-info-set-rank (info rank)
1119   `(setcar (nthcdr 1 ,info) ,rank))
1120 (defmacro gnus-info-set-read (info read)
1121   `(setcar (nthcdr 2 ,info) ,read))
1122 (defmacro gnus-info-set-marks (info marks &optional extend)
1123   (if extend
1124       `(gnus-info-set-entry ,info ,marks 3)
1125     `(setcar (nthcdr 3 ,info) ,marks)))
1126 (defmacro gnus-info-set-method (info method &optional extend)
1127   (if extend
1128       `(gnus-info-set-entry ,info ,method 4)
1129     `(setcar (nthcdr 4 ,info) ,method)))
1130 (defmacro gnus-info-set-params (info params &optional extend)
1131   (if extend
1132       `(gnus-info-set-entry ,info ,params 5)
1133     `(setcar (nthcdr 5 ,info) ,params)))
1134
1135 (defun gnus-info-set-entry (info entry number)
1136   ;; Extend the info until we have enough elements.
1137   (while (< (length info) number)
1138     (nconc info (list nil)))
1139   ;; Set the entry.
1140   (setcar (nthcdr number info) entry))
1141
1142 (defmacro gnus-info-set-level (info level)
1143   `(let ((rank (cdr ,info)))
1144      (if (consp (car rank))
1145          (setcar (car rank) ,level)
1146        (setcar rank ,level))))
1147 (defmacro gnus-info-set-score (info score)
1148   `(let ((rank (cdr ,info)))
1149      (if (consp (car rank))
1150          (setcdr (car rank) ,score)
1151        (setcar rank (cons (car rank) ,score)))))
1152
1153 (defmacro gnus-get-info (group)
1154   `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
1155
1156 ;; Byte-compiler warning.
1157 (defvar gnus-visual)
1158 ;; Find out whether the gnus-visual TYPE is wanted.
1159 (defun gnus-visual-p (&optional type class)
1160   (and gnus-visual                      ; Has to be non-nil, at least.
1161        (if (not type)                   ; We don't care about type.
1162            gnus-visual
1163          (if (listp gnus-visual)        ; It's a list, so we check it.
1164              (or (memq type gnus-visual)
1165                  (memq class gnus-visual))
1166            t))))
1167
1168 ;;; Load the compatability functions.
1169
1170 (require 'gnus-ems)
1171
1172 \f
1173 ;;;
1174 ;;; Shutdown
1175 ;;;
1176
1177 (defvar gnus-shutdown-alist nil)
1178
1179 (defun gnus-add-shutdown (function &rest symbols)
1180   "Run FUNCTION whenever one of SYMBOLS is shut down."
1181   (push (cons function symbols) gnus-shutdown-alist))
1182
1183 (defun gnus-shutdown (symbol)
1184   "Shut down everything that waits for SYMBOL."
1185   (let ((alist gnus-shutdown-alist)
1186         entry)
1187     (while (setq entry (pop alist))
1188       (when (memq symbol (cdr entry))
1189         (funcall (car entry))))))
1190
1191 \f
1192 ;;;
1193 ;;; Gnus Utility Functions
1194 ;;;
1195
1196 ;; Add the current buffer to the list of buffers to be killed on exit.
1197 (defun gnus-add-current-to-buffer-list ()
1198   (or (memq (current-buffer) gnus-buffer-list)
1199       (push (current-buffer) gnus-buffer-list)))
1200
1201 (defun gnus-version (&optional arg)
1202   "Version number of this version of Gnus.
1203 If ARG, insert string at point."
1204   (interactive "P")
1205   (let ((methods gnus-valid-select-methods)
1206         (mess gnus-version)
1207         meth)
1208     ;; Go through all the legal select methods and add their version
1209     ;; numbers to the total version string.  Only the backends that are
1210     ;; currently in use will have their message numbers taken into
1211     ;; consideration.
1212     (while methods
1213       (setq meth (intern (concat (caar methods) "-version")))
1214       (and (boundp meth)
1215            (stringp (symbol-value meth))
1216            (setq mess (concat mess "; " (symbol-value meth))))
1217       (setq methods (cdr methods)))
1218     (if arg
1219         (insert (message mess))
1220       (message mess))))
1221
1222 (defun gnus-continuum-version (version)
1223   "Return VERSION as a floating point number."
1224   (when (or (string-match "^\\([^ ]+\\)? ?Gnus v?\\([0-9.]+\\)$" version)
1225             (string-match "^\\(.?\\)gnus-\\([0-9.]+\\)$" version))
1226     (let* ((alpha (and (match-beginning 1) (match-string 1 version)))
1227            (number (match-string 2 version))
1228            major minor least)
1229       (string-match "\\([0-9]\\)\\.\\([0-9]+\\)\\.?\\([0-9]+\\)?" number)
1230       (setq major (string-to-number (match-string 1 number)))
1231       (setq minor (string-to-number (match-string 2 number)))
1232       (setq least (if (match-beginning 3)
1233                       (string-to-number (match-string 3 number))
1234                     0))
1235       (string-to-number
1236        (if (zerop major)
1237            (format "%s00%02d%02d"
1238                    (cond 
1239                     ((member alpha '("(ding)" "d")) "4.99")
1240                     ((member alpha '("September" "s")) "5.01")
1241                     ((member alpha '("Red" "r")) "5.03"))
1242                    minor least)
1243          (format "%d.%02d%02d" major minor least))))))
1244
1245 (defun gnus-info-find-node ()
1246   "Find Info documentation of Gnus."
1247   (interactive)
1248   ;; Enlarge info window if needed.
1249   (let (gnus-info-buffer)
1250     (Info-goto-node (cadr (assq major-mode gnus-info-nodes)))
1251     (setq gnus-info-buffer (current-buffer))
1252     (gnus-configure-windows 'info)))
1253
1254 ;;; More various functions.
1255
1256 (defun gnus-group-read-only-p (&optional group)
1257   "Check whether GROUP supports editing or not.
1258 If GROUP is nil, `gnus-newsgroup-name' will be checked instead.  Note
1259 that that variable is buffer-local to the summary buffers."
1260   (let ((group (or group gnus-newsgroup-name)))
1261     (not (gnus-check-backend-function 'request-replace-article group))))
1262
1263 (defun gnus-group-total-expirable-p (group)
1264   "Check whether GROUP is total-expirable or not."
1265   (let ((params (gnus-group-find-parameter group))
1266         val)
1267     (cond
1268      ((memq 'total-expire params)
1269       t)
1270      ((setq val (assq 'total-expire params)) ; (auto-expire . t)
1271       (cdr val))
1272      (gnus-total-expirable-newsgroups   ; Check var.
1273       (string-match gnus-total-expirable-newsgroups group)))))
1274
1275 (defun gnus-group-auto-expirable-p (group)
1276   "Check whether GROUP is total-expirable or not."
1277   (let ((params (gnus-group-find-parameter group))
1278         val)
1279     (cond
1280      ((memq 'auto-expire params)
1281       t)
1282      ((setq val (assq 'auto-expire params)) ; (auto-expire . t)
1283       (cdr val))
1284      (gnus-auto-expirable-newsgroups    ; Check var.
1285       (string-match gnus-auto-expirable-newsgroups group)))))
1286
1287 (defun gnus-virtual-group-p (group)
1288   "Say whether GROUP is virtual or not."
1289   (memq 'virtual (assoc (symbol-name (car (gnus-find-method-for-group group)))
1290                         gnus-valid-select-methods)))
1291
1292 (defun gnus-news-group-p (group &optional article)
1293   "Return non-nil if GROUP (and ARTICLE) come from a news server."
1294   (or (gnus-member-of-valid 'post group) ; Ordinary news group.
1295       (and (gnus-member-of-valid 'post-mail group) ; Combined group.
1296            (eq (gnus-request-type group article) 'news))))
1297
1298 ;; Returns a list of writable groups.
1299 (defun gnus-writable-groups ()
1300   (let ((alist gnus-newsrc-alist)
1301         groups group)
1302     (while (setq group (car (pop alist)))
1303       (unless (gnus-group-read-only-p group)
1304         (push group groups)))
1305     (nreverse groups)))
1306
1307 ;; Check whether to use long file names.
1308 (defun gnus-use-long-file-name (symbol)
1309   ;; The variable has to be set...
1310   (and gnus-use-long-file-name
1311        ;; If it isn't a list, then we return t.
1312        (or (not (listp gnus-use-long-file-name))
1313            ;; If it is a list, and the list contains `symbol', we
1314            ;; return nil.
1315            (not (memq symbol gnus-use-long-file-name)))))
1316
1317 ;; Generate a unique new group name.
1318 (defun gnus-generate-new-group-name (leaf)
1319   (let ((name leaf)
1320         (num 0))
1321     (while (gnus-gethash name gnus-newsrc-hashtb)
1322       (setq name (concat leaf "<" (int-to-string (setq num (1+ num))) ">")))
1323     name))
1324
1325 (defun gnus-ephemeral-group-p (group)
1326   "Say whether GROUP is ephemeral or not."
1327   (gnus-group-get-parameter group 'quit-config))
1328
1329 (defun gnus-group-quit-config (group)
1330   "Return the quit-config of GROUP."
1331   (gnus-group-get-parameter group 'quit-config))
1332
1333 (defun gnus-kill-ephemeral-group (group)
1334   "Remove ephemeral GROUP from relevant structures."
1335   (gnus-sethash group nil gnus-newsrc-hashtb))
1336
1337 (defun gnus-simplify-mode-line ()
1338   "Make mode lines a bit simpler."
1339   (setq mode-line-modified "-- ")
1340   (when (listp mode-line-format)
1341     (make-local-variable 'mode-line-format)
1342     (setq mode-line-format (copy-sequence mode-line-format))
1343     (when (equal (nth 3 mode-line-format) "   ")
1344       (setcar (nthcdr 3 mode-line-format) " "))))
1345
1346 ;;; Servers and groups.
1347
1348 (defsubst gnus-server-add-address (method)
1349   (let ((method-name (symbol-name (car method))))
1350     (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
1351              (not (assq (intern (concat method-name "-address")) method)))
1352         (append method (list (list (intern (concat method-name "-address"))
1353                                    (nth 1 method))))
1354       method)))
1355
1356 (defsubst gnus-server-get-method (group method)
1357   ;; Input either a server name, and extended server name, or a
1358   ;; select method, and return a select method.
1359   (cond ((stringp method)
1360          (gnus-server-to-method method))
1361         ((equal method gnus-select-method)
1362          gnus-select-method)
1363         ((and (stringp (car method)) group)
1364          (gnus-server-extend-method group method))
1365         ((and method (not group)
1366               (equal (cadr method) ""))
1367          method)
1368         (t
1369          (gnus-server-add-address method))))
1370
1371 (defun gnus-server-to-method (server)
1372   "Map virtual server names to select methods."
1373   (or 
1374    ;; Is this a method, perhaps?
1375    (and server (listp server) server)
1376    ;; Perhaps this is the native server?
1377    (and (equal server "native") gnus-select-method)
1378    ;; It should be in the server alist.
1379    (cdr (assoc server gnus-server-alist))
1380    ;; It could be in the predefined server alist.
1381    (cdr (assoc server gnus-predefined-server-alist))
1382    ;; If not, we look through all the opened server
1383    ;; to see whether we can find it there.
1384    (let ((opened gnus-opened-servers))
1385      (while (and opened
1386                  (not (equal server (format "%s:%s" (caaar opened)
1387                                             (cadaar opened)))))
1388        (pop opened))
1389      (caar opened))))
1390
1391 (defmacro gnus-method-equal (ss1 ss2)
1392   "Say whether two servers are equal."
1393   `(let ((s1 ,ss1)
1394          (s2 ,ss2))
1395      (or (equal s1 s2)
1396          (and (= (length s1) (length s2))
1397               (progn
1398                 (while (and s1 (member (car s1) s2))
1399                   (setq s1 (cdr s1)))
1400                 (null s1))))))
1401
1402 (defun gnus-server-equal (m1 m2)
1403   "Say whether two methods are equal."
1404   (let ((m1 (cond ((null m1) gnus-select-method)
1405                   ((stringp m1) (gnus-server-to-method m1))
1406                   (t m1)))
1407         (m2 (cond ((null m2) gnus-select-method)
1408                   ((stringp m2) (gnus-server-to-method m2))
1409                   (t m2))))
1410     (gnus-method-equal m1 m2)))
1411
1412 (defun gnus-servers-using-backend (backend)
1413   "Return a list of known servers using BACKEND."
1414   (let ((opened gnus-opened-servers)
1415         out)
1416     (while opened
1417       (when (eq backend (caaar opened))
1418         (push (caar opened) out))
1419       (pop opened))
1420     out))
1421
1422 (defun gnus-archive-server-wanted-p ()
1423   "Say whether the user wants to use the archive server."
1424   (cond 
1425    ((or (not gnus-message-archive-method)
1426         (not gnus-message-archive-group))
1427     nil)
1428    ((and gnus-message-archive-method gnus-message-archive-group)
1429     t)
1430    (t
1431     (let ((active (cadr (assq 'nnfolder-active-file
1432                               gnus-message-archive-method))))
1433       (and active
1434            (file-exists-p active))))))
1435
1436 (defun gnus-group-prefixed-name (group method)
1437   "Return the whole name from GROUP and METHOD."
1438   (and (stringp method) (setq method (gnus-server-to-method method)))
1439   (if (not method)
1440       group
1441     (concat (format "%s" (car method))
1442             (when (and
1443                    (or (assoc (format "%s" (car method))
1444                               (gnus-methods-using 'address))
1445                        (gnus-server-equal method gnus-message-archive-method))
1446                    (nth 1 method)
1447                    (not (string= (nth 1 method) "")))
1448               (concat "+" (nth 1 method)))
1449             ":" group)))
1450
1451 (defun gnus-group-real-prefix (group)
1452   "Return the prefix of the current group name."
1453   (if (string-match "^[^:]+:" group)
1454       (substring group 0 (match-end 0))
1455     ""))
1456
1457 (defun gnus-group-method (group)
1458   "Return the server or method used for selecting GROUP."
1459   (let ((prefix (gnus-group-real-prefix group)))
1460     (if (equal prefix "")
1461         gnus-select-method
1462       (let ((servers gnus-opened-servers)
1463             (server "")
1464             backend possible found)
1465         (if (string-match "^[^\\+]+\\+" prefix)
1466             (setq backend (intern (substring prefix 0 (1- (match-end 0))))
1467                   server (substring prefix (match-end 0) (1- (length prefix))))
1468           (setq backend (intern (substring prefix 0 (1- (length prefix))))))
1469         (while servers
1470           (when (eq (caaar servers) backend)
1471             (setq possible (caar servers))
1472             (when (equal (cadaar servers) server)
1473               (setq found (caar servers))))
1474           (pop servers))
1475         (or (car (rassoc found gnus-server-alist))
1476             found
1477             (car (rassoc possible gnus-server-alist))
1478             possible
1479             (list backend server))))))
1480
1481 (defsubst gnus-secondary-method-p (method)
1482   "Return whether METHOD is a secondary select method."
1483   (let ((methods gnus-secondary-select-methods)
1484         (gmethod (gnus-server-get-method nil method)))
1485     (while (and methods
1486                 (not (equal (gnus-server-get-method nil (car methods))
1487                             gmethod)))
1488       (setq methods (cdr methods)))
1489     methods))
1490
1491 (defun gnus-group-foreign-p (group)
1492   "Say whether a group is foreign or not."
1493   (and (not (gnus-group-native-p group))
1494        (not (gnus-group-secondary-p group))))
1495
1496 (defun gnus-group-native-p (group)
1497   "Say whether the group is native or not."
1498   (not (string-match ":" group)))
1499
1500 (defun gnus-group-secondary-p (group)
1501   "Say whether the group is secondary or not."
1502   (gnus-secondary-method-p (gnus-find-method-for-group group)))
1503
1504 (defun gnus-group-find-parameter (group &optional symbol)
1505   "Return the group parameters for GROUP.
1506 If SYMBOL, return the value of that symbol in the group parameters."
1507   (save-excursion
1508     (set-buffer gnus-group-buffer)
1509     (let ((parameters (funcall gnus-group-get-parameter-function group)))
1510       (if symbol
1511           (gnus-group-parameter-value parameters symbol)
1512         parameters))))
1513
1514 (defun gnus-group-get-parameter (group &optional symbol)
1515   "Return the group parameters for GROUP.
1516 If SYMBOL, return the value of that symbol in the group parameters."
1517   (let ((params (gnus-info-params (gnus-get-info group))))
1518     (if symbol
1519         (gnus-group-parameter-value params symbol)
1520       params)))
1521
1522 (defun gnus-group-parameter-value (params symbol)
1523   "Return the value of SYMBOL in group PARAMS."
1524   (or (car (memq symbol params))        ; It's either a simple symbol
1525       (cdr (assq symbol params))))      ; or a cons.
1526
1527 (defun gnus-group-add-parameter (group param)
1528   "Add parameter PARAM to GROUP."
1529   (let ((info (gnus-get-info group)))
1530     (if (not info)
1531         ()                              ; This is a dead group.  We just ignore it.
1532       ;; Cons the new param to the old one and update.
1533       (gnus-group-set-info (cons param (gnus-info-params info))
1534                            group 'params))))
1535
1536 (defun gnus-group-set-parameter (group name value)
1537   "Set parameter NAME to VALUE in GROUP."
1538   (let ((info (gnus-get-info group)))
1539     (if (not info)
1540         ()                              ; This is a dead group.  We just ignore it.
1541       (let ((old-params (gnus-info-params info))
1542             (new-params (list (cons name value))))
1543         (while old-params
1544           (when (or (not (listp (car old-params)))
1545                     (not (eq (caar old-params) name)))
1546             (setq new-params (append new-params (list (car old-params)))))
1547           (setq old-params (cdr old-params)))
1548         (gnus-group-set-info new-params group 'params)))))
1549
1550 (defun gnus-group-add-score (group &optional score)
1551   "Add SCORE to the GROUP score.
1552 If SCORE is nil, add 1 to the score of GROUP."
1553   (let ((info (gnus-get-info group)))
1554     (when info
1555       (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
1556
1557 ;; Function written by Stainless Steel Rat <ratinox@peorth.gweep.net>
1558 (defun gnus-short-group-name (group &optional levels)
1559   "Collapse GROUP name LEVELS.
1560 Select methods are stripped and any remote host name is stripped down to
1561 just the host name."
1562   (let* ((name "") (foreign "") (depth -1) (skip 1)
1563          (levels (or levels
1564                      (progn
1565                        (while (string-match "\\." group skip)
1566                          (setq skip (match-end 0)
1567                                depth (+ depth 1)))
1568                        depth))))
1569     ;; separate foreign select method from group name and collapse.
1570     ;; if method contains a server, collapse to non-domain server name,
1571     ;; otherwise collapse to select method
1572     (when (string-match ":" group)
1573       (cond ((string-match "+" group)
1574              (let* ((plus (string-match "+" group))
1575                     (colon (string-match ":" group (or plus 0)))
1576                     (dot (string-match "\\." group)))
1577                (setq foreign (concat
1578                               (substring group (+ 1 plus)
1579                                          (cond ((null dot) colon)
1580                                                ((< colon dot) colon)
1581                                                ((< dot colon) dot)))
1582                               ":")
1583                      group (substring group (+ 1 colon)))))
1584             (t
1585              (let* ((colon (string-match ":" group)))
1586                (setq foreign (concat (substring group 0 (+ 1 colon)))
1587                      group (substring group (+ 1 colon)))))))
1588     ;; collapse group name leaving LEVELS uncollapsed elements
1589     (while group
1590       (if (and (string-match "\\." group) (> levels 0))
1591           (setq name (concat name (substring group 0 1))
1592                 group (substring group (match-end 0))
1593                 levels (- levels 1)
1594                 name (concat name "."))
1595         (setq name (concat foreign name group)
1596               group nil)))
1597     name))
1598
1599 \f
1600 ;;;
1601 ;;; Kill file handling.
1602 ;;;
1603
1604 (defun gnus-apply-kill-file ()
1605   "Apply a kill file to the current newsgroup.
1606 Returns the number of articles marked as read."
1607   (if (or (file-exists-p (gnus-newsgroup-kill-file nil))
1608           (file-exists-p (gnus-newsgroup-kill-file gnus-newsgroup-name)))
1609       (gnus-apply-kill-file-internal)
1610     0))
1611
1612 (defun gnus-kill-save-kill-buffer ()
1613   (let ((file (gnus-newsgroup-kill-file gnus-newsgroup-name)))
1614     (when (get-file-buffer file)
1615       (save-excursion
1616         (set-buffer (get-file-buffer file))
1617         (when (buffer-modified-p)
1618           (save-buffer))
1619         (kill-buffer (current-buffer))))))
1620
1621 (defcustom gnus-kill-file-name "KILL"
1622   "Suffix of the kill files."
1623   :group 'gnus-score
1624   :type 'string)
1625
1626 (defun gnus-newsgroup-kill-file (newsgroup)
1627   "Return the name of a kill file name for NEWSGROUP.
1628 If NEWSGROUP is nil, return the global kill file name instead."
1629   (cond 
1630    ;; The global KILL file is placed at top of the directory.
1631    ((or (null newsgroup)
1632         (string-equal newsgroup ""))
1633     (expand-file-name gnus-kill-file-name
1634                       gnus-kill-files-directory))
1635    ;; Append ".KILL" to newsgroup name.
1636    ((gnus-use-long-file-name 'not-kill)
1637     (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup)
1638                               "." gnus-kill-file-name)
1639                       gnus-kill-files-directory))
1640    ;; Place "KILL" under the hierarchical directory.
1641    (t
1642     (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
1643                               "/" gnus-kill-file-name)
1644                       gnus-kill-files-directory))))
1645
1646 ;;; Server things.
1647
1648 (defun gnus-member-of-valid (symbol group)
1649   "Find out if GROUP has SYMBOL as part of its \"valid\" spec."
1650   (memq symbol (assoc
1651                 (symbol-name (car (gnus-find-method-for-group group)))
1652                 gnus-valid-select-methods)))
1653
1654 (defun gnus-method-option-p (method option)
1655   "Return non-nil if select METHOD has OPTION as a parameter."
1656   (when (stringp method)
1657     (setq method (gnus-server-to-method method)))
1658   (memq option (assoc (format "%s" (car method))
1659                       gnus-valid-select-methods)))
1660
1661 (defun gnus-server-extend-method (group method)
1662   ;; This function "extends" a virtual server.  If the server is
1663   ;; "hello", and the select method is ("hello" (my-var "something"))
1664   ;; in the group "alt.alt", this will result in a new virtual server
1665   ;; called "hello+alt.alt".
1666   (let ((entry
1667          (gnus-copy-sequence
1668           (if (gnus-server-equal method gnus-select-method) gnus-select-method
1669             (cdr (assoc (car method) gnus-server-alist))))))
1670     (if (not entry)
1671         method
1672       (setcar (cdr entry) (concat (nth 1 entry) "+" group))
1673       (nconc entry (cdr method)))))
1674
1675 (defun gnus-server-status (method)
1676   "Return the status of METHOD."
1677   (nth 1 (assoc method gnus-opened-servers)))
1678
1679 (defun gnus-group-name-to-method (group)
1680   "Return a select method suitable for GROUP."
1681   (if (string-match ":" group)
1682       (let ((server (substring group 0 (match-beginning 0))))
1683         (if (string-match "\\+" server)
1684             (list (intern (substring server 0 (match-beginning 0)))
1685                   (substring server (match-end 0)))
1686           (list (intern server) "")))
1687     gnus-select-method))
1688
1689 (defun gnus-find-method-for-group (group &optional info)
1690   "Find the select method that GROUP uses."
1691   (or gnus-override-method
1692       (and (not group)
1693            gnus-select-method)
1694       (let ((info (or info (gnus-get-info group)))
1695             method)
1696         (if (or (not info)
1697                 (not (setq method (gnus-info-method info)))
1698                 (equal method "native"))
1699             gnus-select-method
1700           (setq method
1701                 (cond ((stringp method)
1702                        (gnus-server-to-method method))
1703                       ((stringp (car method))
1704                        (gnus-server-extend-method group method))
1705                       (t
1706                        method)))
1707           (cond ((equal (cadr method) "")
1708                  method)
1709                 ((null (cadr method))
1710                  (list (car method) ""))
1711                 (t
1712                  (gnus-server-add-address method)))))))
1713
1714 (defun gnus-check-backend-function (func group)
1715   "Check whether GROUP supports function FUNC."
1716   (let ((method (if (stringp group) (car (gnus-find-method-for-group group))
1717                   group)))
1718     (unless (featurep method)
1719       (require method))
1720     (fboundp (intern (format "%s-%s" method func)))))
1721
1722 (defun gnus-methods-using (feature)
1723   "Find all methods that have FEATURE."
1724   (let ((valids gnus-valid-select-methods)
1725         outs)
1726     (while valids
1727       (when (memq feature (car valids))
1728         (push (car valids) outs))
1729       (setq valids (cdr valids)))
1730     outs))
1731
1732 (defun gnus-read-method (prompt)
1733   "Prompt the user for a method.
1734 Allow completion over sensible values."
1735   (let ((method
1736          (completing-read
1737           prompt (append gnus-valid-select-methods gnus-predefined-server-alist
1738                          gnus-server-alist)
1739           nil t nil 'gnus-method-history)))
1740     (cond 
1741      ((equal method "")
1742       (setq method gnus-select-method))
1743      ((assoc method gnus-valid-select-methods)
1744       (list (intern method)
1745             (if (memq 'prompt-address
1746                       (assoc method gnus-valid-select-methods))
1747                 (read-string "Address: ")
1748               "")))
1749      ((assoc method gnus-server-alist)
1750       method)
1751      (t
1752       (list (intern method) "")))))
1753
1754 ;;; User-level commands.
1755
1756 ;;;###autoload
1757 (defun gnus-slave-no-server (&optional arg)
1758   "Read network news as a slave, without connecting to local server"
1759   (interactive "P")
1760   (gnus-no-server arg t))
1761
1762 ;;;###autoload
1763 (defun gnus-no-server (&optional arg slave)
1764   "Read network news.
1765 If ARG is a positive number, Gnus will use that as the
1766 startup level.  If ARG is nil, Gnus will be started at level 2.
1767 If ARG is non-nil and not a positive number, Gnus will
1768 prompt the user for the name of an NNTP server to use.
1769 As opposed to `gnus', this command will not connect to the local server."
1770   (interactive "P")
1771   (gnus-no-server-1 arg slave))
1772
1773 ;;;###autoload
1774 (defun gnus-slave (&optional arg)
1775   "Read news as a slave."
1776   (interactive "P")
1777   (gnus arg nil 'slave))
1778
1779 ;;;###autoload
1780 (defun gnus-other-frame (&optional arg)
1781   "Pop up a frame to read news."
1782   (interactive "P")
1783   (if (gnus-alive-p)
1784       (let ((pop-up-frames t))
1785         (gnus arg))
1786     (select-frame (make-frame))
1787     (gnus arg)))
1788
1789 ;;;###autoload
1790 (defun gnus (&optional arg dont-connect slave)
1791   "Read network news.
1792 If ARG is non-nil and a positive number, Gnus will use that as the
1793 startup level.  If ARG is non-nil and not a positive number, Gnus will
1794 prompt the user for the name of an NNTP server to use."
1795   (interactive "P")
1796   (gnus-1 arg dont-connect slave))
1797
1798 ;; Allow redefinition of Gnus functions.
1799
1800 (gnus-ems-redefine)
1801
1802 (provide 'gnus)
1803
1804 ;;; gnus.el ends here