(nnimap-request-list): Protect against not being able to open the server.
[gnus] / lisp / gnus-setup.el
1 ;;; gnus-setup.el --- Initialization & Setup for Gnus 5
2
3 ;; Copyright (C) 1995-1996, 2000-2011 Free Software Foundation, Inc.
4
5 ;; Author: Steven L. Baur <steve@miranova.com>
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 3 of the License, or
13 ;; (at your option) 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.  If not, see <http://www.gnu.org/licenses/>.
22
23 ;;; Commentary:
24 ;; My head is starting to spin with all the different mail/news packages.
25 ;; Stop The Madness!
26
27 ;; Given that Emacs Lisp byte codes may be diverging, it is probably best
28 ;; not to byte compile this, and just arrange to have the .el loaded out
29 ;; of .emacs.
30
31 ;;; Code:
32
33 (eval-when-compile (require 'cl))
34
35 (defvar gnus-use-installed-gnus t
36   "*If non-nil use installed version of Gnus.")
37
38 (defvar gnus-use-installed-mailcrypt (featurep 'xemacs)
39   "*If non-nil use installed version of mailcrypt.")
40
41 (defvar gnus-emacs-lisp-directory (if (featurep 'xemacs)
42                                       "/usr/local/lib/xemacs/"
43                                     "/usr/local/share/emacs/")
44   "Directory where Emacs site lisp is located.")
45
46 (defvar gnus-gnus-lisp-directory (concat gnus-emacs-lisp-directory
47                                          "gnus/lisp/")
48   "Directory where Gnus Emacs lisp is found.")
49
50 (defvar gnus-mailcrypt-lisp-directory (concat gnus-emacs-lisp-directory
51                                               "site-lisp/mailcrypt/")
52   "Directory where Mailcrypt Emacs Lisp is found.")
53
54 (defvar gnus-bbdb-lisp-directory (concat gnus-emacs-lisp-directory
55                                          "site-lisp/bbdb/")
56   "Directory where Big Brother Database is found.")
57
58 (defvar gnus-use-mhe nil
59   "Set this if you want to use MH-E for mail reading.")
60 (defvar gnus-use-rmail nil
61   "Set this if you want to use RMAIL for mail reading.")
62 (defvar gnus-use-sendmail t
63   "Set this if you want to use SENDMAIL for mail reading.")
64 (defvar gnus-use-vm nil
65   "Set this if you want to use the VM package for mail reading.")
66 (defvar gnus-use-sc nil
67   "Set this if you want to use Supercite.")
68 (defvar gnus-use-mailcrypt t
69   "Set this if you want to use Mailcrypt for dealing with PGP messages.")
70 (defvar gnus-use-bbdb nil
71   "Set this if you want to use the Big Brother DataBase.")
72
73 (when (and (not gnus-use-installed-gnus)
74            (null (member gnus-gnus-lisp-directory load-path)))
75   (push gnus-gnus-lisp-directory load-path))
76
77 ;;; We can't do this until we know where Gnus is.
78 (require 'message)
79
80 ;;; Mailcrypt by
81 ;;; Jin Choi <jin@atype.com>
82 ;;; Patrick LoPresti <patl@lcs.mit.edu>
83
84 (when gnus-use-mailcrypt
85   (when (and (not gnus-use-installed-mailcrypt)
86              (null (member gnus-mailcrypt-lisp-directory load-path)))
87     (setq load-path (cons gnus-mailcrypt-lisp-directory load-path)))
88   (autoload 'mc-install-write-mode "mailcrypt" nil t)
89   (autoload 'mc-install-read-mode "mailcrypt" nil t)
90 ;;;   (add-hook 'message-mode-hook 'mc-install-write-mode)
91 ;;;   (add-hook 'gnus-summary-mode-hook 'mc-install-read-mode)
92   (when gnus-use-mhe
93     (add-hook 'mh-folder-mode-hook 'mc-install-read-mode)
94     (add-hook 'mh-letter-mode-hook 'mc-install-write-mode)))
95
96 ;;; BBDB by
97 ;;; Jamie Zawinski <jwz@lucid.com>
98
99 (when gnus-use-bbdb
100   ;; bbdb will never be installed with emacs.
101   (when (null (member gnus-bbdb-lisp-directory load-path))
102     (setq load-path (cons gnus-bbdb-lisp-directory load-path)))
103   (autoload 'bbdb "bbdb-com"
104     "Insidious Big Brother Database" t)
105   (autoload 'bbdb-name "bbdb-com"
106     "Insidious Big Brother Database" t)
107   (autoload 'bbdb-company "bbdb-com"
108     "Insidious Big Brother Database" t)
109   (autoload 'bbdb-net "bbdb-com"
110     "Insidious Big Brother Database" t)
111   (autoload 'bbdb-notes "bbdb-com"
112     "Insidious Big Brother Database" t)
113
114   (when gnus-use-vm
115     (autoload 'bbdb-insinuate-vm "bbdb-vm"
116       "Hook BBDB into VM" t))
117
118   (when gnus-use-rmail
119     (autoload 'bbdb-insinuate-rmail "bbdb-rmail"
120       "Hook BBDB into RMAIL" t)
121     (add-hook 'rmail-mode-hook 'bbdb-insinuate-rmail))
122
123   (when gnus-use-mhe
124     (autoload 'bbdb-insinuate-mh "bbdb-mh"
125       "Hook BBDB into MH-E" t)
126     (add-hook 'mh-folder-mode-hook 'bbdb-insinuate-mh))
127
128   (autoload 'bbdb-insinuate-gnus "bbdb-gnus"
129     "Hook BBDB into Gnus" t)
130   (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
131
132   (when gnus-use-sendmail
133     (autoload 'bbdb-insinuate-sendmail "bbdb"
134       "Insidious Big Brother Database" t)
135     (add-hook 'mail-setup-hook 'bbdb-insinuate-sendmail)
136     (add-hook 'message-setup-hook 'bbdb-insinuate-sendmail)))
137
138 (when gnus-use-sc
139   (add-hook 'mail-citation-hook 'sc-cite-original)
140   (setq message-cite-function 'sc-cite-original))
141 \f
142 ;;;### (autoloads (gnus gnus-slave gnus-no-server) "gnus" "lisp/gnus.el" (12473 2137))
143 ;;; Generated autoloads from lisp/gnus.el
144
145 ;; Don't redo this if autoloads already exist
146 (unless (fboundp 'gnus)
147   (autoload 'gnus-slave-no-server "gnus" "\
148 Read network news as a slave without connecting to local server." t nil)
149
150   (autoload 'gnus-no-server "gnus" "\
151 Read network news.
152 If ARG is a positive number, Gnus will use that as the
153 startup level.  If ARG is nil, Gnus will be started at level 2.
154 If ARG is non-nil and not a positive number, Gnus will
155 prompt the user for the name of an NNTP server to use.
156 As opposed to `gnus', this command will not connect to the local server." t nil)
157
158   (autoload 'gnus-slave "gnus" "\
159 Read news as a slave." t nil)
160
161   (autoload 'gnus "gnus" "\
162 Read network news.
163 If ARG is non-nil and a positive number, Gnus will use that as the
164 startup level.  If ARG is non-nil and not a positive number, Gnus will
165 prompt the user for the name of an NNTP server to use." t nil)
166
167 ;;;***
168
169 ;;; These have moved out of gnus.el into other files.
170 ;;; FIX FIX FIX: should other things be in gnus-setup? or these not in it?
171   (autoload 'gnus-update-format "gnus-spec" "\
172 Update the format specification near point." t nil)
173
174   (autoload 'gnus-fetch-group "gnus-group" "\
175 Start Gnus if necessary and enter GROUP.
176 Returns whether the fetching was successful or not." t nil)
177
178   (defalias 'gnus-batch-kill 'gnus-batch-score)
179
180   (autoload 'gnus-batch-score "gnus-kill" "\
181 Run batched scoring.
182 Usage: emacs -batch -l gnus -f gnus-batch-score <newsgroups> ...
183 Newsgroups is a list of strings in Bnews format.  If you want to score
184 the comp hierarchy, you'd say \"comp.all\".  If you would not like to
185 score the alt hierarchy, you'd say \"!alt.all\"." t nil))
186
187 (provide 'gnus-setup)
188
189 (run-hooks 'gnus-setup-load-hook)
190
191 ;;; gnus-setup.el ends here