gnus-start.el, gnus-sum.el: Fix ambiguous doc string cross-references
[gnus] / lisp / nnmail.el
1 ;;; nnmail.el --- mail support functions for the Gnus mail backends
2
3 ;; Copyright (C) 1995-2013 Free Software Foundation, Inc.
4
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: news, mail
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
25 ;;; Code:
26
27 ;; For Emacs <22.2 and XEmacs.
28 (eval-and-compile
29   (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
30
31 (eval-when-compile (require 'cl))
32
33 (require 'gnus)                         ; for macro gnus-kill-buffer, at least
34 (require 'nnheader)
35 (require 'message)
36 (require 'gnus-util)
37 (require 'mail-source)
38 (require 'mm-util)
39 (require 'gnus-int)
40
41 (autoload 'gnus-add-buffer "gnus")
42 (autoload 'gnus-kill-buffer "gnus")
43 (eval-when-compile
44   (autoload 'mail-send-and-exit "sendmail" nil t))
45
46 (defgroup nnmail nil
47   "Reading mail with Gnus."
48   :group 'gnus)
49
50 (defgroup nnmail-retrieve nil
51   "Retrieving new mail."
52   :group 'nnmail)
53
54 (defgroup nnmail-prepare nil
55   "Preparing (or mangling) new mail after retrieval."
56   :group 'nnmail)
57
58 (defgroup nnmail-duplicate nil
59   "Handling of duplicate mail messages."
60   :group 'nnmail)
61
62 (defgroup nnmail-split nil
63   "Organizing the incoming mail in folders."
64   :group 'nnmail)
65
66 (defgroup nnmail-files nil
67   "Mail files."
68   :group 'gnus-files
69   :group 'nnmail)
70
71 (defgroup nnmail-expire nil
72   "Expiring old mail."
73   :group 'nnmail)
74
75 (defgroup nnmail-procmail nil
76   "Interfacing with procmail and other mail agents."
77   :group 'nnmail)
78
79 (defgroup nnmail-various nil
80   "Various mail options."
81   :group 'nnmail)
82
83 (defcustom nnmail-split-methods '(("mail.misc" ""))
84   "*Incoming mail will be split according to this variable.
85
86 If you'd like, for instance, one mail group for mail from the
87 \"4ad-l\" mailing list, one group for junk mail and one for everything
88 else, you could do something like this:
89
90  (setq nnmail-split-methods
91        '((\"mail.4ad\" \"From:.*4ad\")
92          (\"mail.junk\" \"From:.*Lars\\\\|Subject:.*buy\")
93          (\"mail.misc\" \"\")))
94
95 As you can see, this variable is a list of lists, where the first
96 element in each \"rule\" is the name of the group (which, by the way,
97 does not have to be called anything beginning with \"mail\",
98 \"yonka.zow\" is a fine, fine name), and the second is a regexp that
99 nnmail will try to match on the header to find a fit.
100
101 The second element can also be a function.  In that case, it will be
102 called narrowed to the headers with the first element of the rule as
103 the argument.  It should return a non-nil value if it thinks that the
104 mail belongs in that group.
105
106 The last element should always have \"\" as the regexp.
107
108 This variable can also have a function as its value, and it can
109 also have a fancy split method as its value.  See
110 `nnmail-split-fancy' for an explanation of that syntax."
111   :group 'nnmail-split
112   :type '(choice (repeat :tag "Alist" (group (string :tag "Name")
113                                              (choice regexp function)))
114                  (function-item nnmail-split-fancy)
115                  (function :tag "Other")))
116
117 ;; Suggested by Erik Selberg <speed@cs.washington.edu>.
118 (defcustom nnmail-crosspost t
119   "If non-nil, do crossposting if several split methods match the mail.
120 If nil, the first match found will be used."
121   :group 'nnmail-split
122   :type 'boolean)
123
124 (defcustom nnmail-split-fancy-with-parent-ignore-groups nil
125   "Regexp that matches group names to be ignored when applying `nnmail-split-fancy-with-parent'.
126 This can also be a list of regexps."
127   :version "22.1"
128   :group 'nnmail-split
129   :type '(choice (const :tag "none" nil)
130                  (regexp :value ".*")
131                  (repeat :value (".*") regexp)))
132
133 (defcustom nnmail-cache-ignore-groups nil
134   "Regexp that matches group names to be ignored when inserting message ids into the cache (`nnmail-cache-insert').
135 This can also be a list of regexps."
136   :version "22.1"
137   :group 'nnmail-split
138   :type '(choice (const :tag "none" nil)
139                  (regexp :value ".*")
140                  (repeat :value (".*") regexp)))
141
142 ;; Added by gord@enci.ucalgary.ca (Gordon Matzigkeit).
143 (defcustom nnmail-keep-last-article nil
144   "If non-nil, nnmail will never delete/move a group's last article.
145 It can be marked expirable, so it will be deleted when it is no longer last.
146
147 You may need to set this variable if other programs are putting
148 new mail into folder numbers that Gnus has marked as expired."
149   :group 'nnmail-procmail
150   :group 'nnmail-various
151   :type 'boolean)
152
153 (defcustom nnmail-use-long-file-names nil
154   "If non-nil the mail backends will use long file and directory names.