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