comparison lisp/gnus/nnmail.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents 8fc7fe29b841
children 441bb1e64a06
comparison
equal deleted inserted replaced
23:0edd3412f124 24:4103f0995bd7
29 (require 'timezone) 29 (require 'timezone)
30 (require 'message) 30 (require 'message)
31 (eval-when-compile (require 'cl)) 31 (eval-when-compile (require 'cl))
32 (require 'custom) 32 (require 'custom)
33 33
34 (defgroup gnus-mail nil 34 (defgroup nnmail nil
35 "Mailreading.." 35 "Reading mail with Gnus."
36 :group 'gnus) 36 :group 'gnus)
37
38 (defgroup nnmail-retrieve nil
39 "Retrieving new mail."
40 :group 'nnmail)
41
42 (defgroup nnmail-prepare nil
43 "Preparing (or mangling) new mail after retrival."
44 :group 'nnmail)
45
46 (defgroup nnmail-duplicate nil
47 "Handling of duplicate mail messages."
48 :group 'nnmail)
49
50 (defgroup nnmail-split nil
51 "Organizing the incomming mail in folders."
52 :group 'nnmail)
53
54 (defgroup nnmail-files nil
55 "Mail files."
56 :group 'gnus-files
57 :group 'nnmail)
58
59 (defgroup nnmail-expire nil
60 "Expiring old mail."
61 :group 'nnmail)
62
63 (defgroup nnmail-procmail nil
64 "Interfacing with procmail and other mail agents."
65 :group 'nnmail)
66
67 (defgroup nnmail-various nil
68 "Various mail options."
69 :group 'nnmail)
37 70
38 (defcustom nnmail-split-methods 71 (defcustom nnmail-split-methods
39 '(("mail.misc" "")) 72 '(("mail.misc" ""))
40 "Incoming mail will be split according to this variable. 73 "Incoming mail will be split according to this variable.
41 74
60 mail belongs in that group. 93 mail belongs in that group.
61 94
62 The last element should always have \"\" as the regexp. 95 The last element should always have \"\" as the regexp.
63 96
64 This variable can also have a function as its value." 97 This variable can also have a function as its value."
65 :group 'gnus-mail 98 :group 'nnmail-split
66 :type '(choice (repeat :tag "Alist" (group (string :tag "Name") regexp)) 99 :type '(choice (repeat :tag "Alist" (group (string :tag "Name") regexp))
67 (function-item nnmail-split-fancy) 100 (function-item nnmail-split-fancy)
68 (function :tag "Other"))) 101 (function :tag "Other")))
69 102
70 ;; Suggested by Erik Selberg <speed@cs.washington.edu>. 103 ;; Suggested by Erik Selberg <speed@cs.washington.edu>.
71 (defcustom nnmail-crosspost t 104 (defcustom nnmail-crosspost t
72 "If non-nil, do crossposting if several split methods match the mail. 105 "If non-nil, do crossposting if several split methods match the mail.
73 If nil, the first match found will be used." 106 If nil, the first match found will be used."
74 :group 'gnus-mail 107 :group 'nnmail-split
75 :type 'boolean) 108 :type 'boolean)
76 109
77 ;; Added by gord@enci.ucalgary.ca (Gordon Matzigkeit). 110 ;; Added by gord@enci.ucalgary.ca (Gordon Matzigkeit).
78 (defcustom nnmail-keep-last-article nil 111 (defcustom nnmail-keep-last-article nil
79 "If non-nil, nnmail will never delete the last expired article in a directory. 112 "If non-nil, nnmail will never delete the last expired article in a directory.
80 You may need to set this variable if other programs are putting 113 You may need to set this variable if other programs are putting
81 new mail into folder numbers that Gnus has marked as expired." 114 new mail into folder numbers that Gnus has marked as expired."
82 :group 'gnus-mail 115 :group 'nnmail-procmail
116 :group 'nnmail-various
83 :type 'boolean) 117 :type 'boolean)
84 118
85 (defcustom nnmail-use-long-file-names nil 119 (defcustom nnmail-use-long-file-names nil
86 "If non-nil the mail backends will use long file and directory names. 120 "If non-nil the mail backends will use long file and directory names.
87 If nil, groups like \"mail.misc\" will end up in directories like 121 If nil, groups like \"mail.misc\" will end up in directories like
88 \"mail/misc/\"." 122 \"mail/misc/\"."
89 :group 'gnus-mail 123 :group 'nnmail-files
90 :type 'boolean) 124 :type 'boolean)
91 125
92 (defcustom nnmail-default-file-modes 384 126 (defcustom nnmail-default-file-modes 384
93 "Set the mode bits of all new mail files to this integer." 127 "Set the mode bits of all new mail files to this integer."
94 :group 'gnus-mail 128 :group 'nnmail-files
95 :type 'integer) 129 :type 'integer)
96 130
97 (defcustom nnmail-expiry-wait 7 131 (defcustom nnmail-expiry-wait 7
98 "*Expirable articles that are older than this will be expired. 132 "*Expirable articles that are older than this will be expired.
99 This variable can either be a number (which will be interpreted as a 133 This variable can either be a number (which will be interpreted as a
100 number of days) -- this doesn't have to be an integer. This variable 134 number of days) -- this doesn't have to be an integer. This variable
101 can also be `immediate' and `never'." 135 can also be `immediate' and `never'."
102 :group 'gnus-mail 136 :group 'nnmail-expire
103 :type '(choice (const immediate) 137 :type '(choice (const immediate)
104 (integer :tag "days") 138 (integer :tag "days")
105 (const never))) 139 (const never)))
106 140
107 (defcustom nnmail-expiry-wait-function nil 141 (defcustom nnmail-expiry-wait-function nil
117 (lambda (newsgroup) 151 (lambda (newsgroup)
118 (cond ((string-match \"private\" newsgroup) 31) 152 (cond ((string-match \"private\" newsgroup) 31)
119 ((string-match \"junk\" newsgroup) 1) 153 ((string-match \"junk\" newsgroup) 1)
120 ((string-match \"important\" newsgroup) 'never) 154 ((string-match \"important\" newsgroup) 'never)
121 (t 7))))" 155 (t 7))))"
122 :group 'gnus-mail 156 :group 'nnmail-expire
123 :type '(choice (const :tag "nnmail-expiry-wait" nil) 157 :type '(choice (const :tag "nnmail-expiry-wait" nil)
124 (function :format "%v" nnmail-))) 158 (function :format "%v" nnmail-)))
125 159
126 (defcustom nnmail-spool-file 160 (defcustom nnmail-spool-file
127 (or (getenv "MAIL") 161 (or (getenv "MAIL")
131 If this variable is nil, no mail backends will read incoming mail. 165 If this variable is nil, no mail backends will read incoming mail.
132 If this variable is a list, all files mentioned in this list will be 166 If this variable is a list, all files mentioned in this list will be
133 used as incoming mailboxes. 167 used as incoming mailboxes.
134 If this variable is a directory (i. e., it's name ends with a \"/\"), 168 If this variable is a directory (i. e., it's name ends with a \"/\"),
135 treat all files in that directory as incoming spool files." 169 treat all files in that directory as incoming spool files."
136 :group 'gnus-mail 170 :group 'nnmail-files
137 :type 'file) 171 :type 'file)
138 172
139 (defcustom nnmail-crash-box "~/.gnus-crash-box" 173 (defcustom nnmail-crash-box "~/.gnus-crash-box"
140 "File where Gnus will store mail while processing it." 174 "File where Gnus will store mail while processing it."
141 :group 'gnus-mail 175 :group 'nnmail-files
142 :type 'file) 176 :type 'file)
143 177
144 (defcustom nnmail-use-procmail nil 178 (defcustom nnmail-use-procmail nil
145 "*If non-nil, the mail backends will look in `nnmail-procmail-directory' for spool files. 179 "*If non-nil, the mail backends will look in `nnmail-procmail-directory' for spool files.
146 The file(s) in `nnmail-spool-file' will also be read." 180 The file(s) in `nnmail-spool-file' will also be read."
147 :group 'gnus-mail 181 :group 'nnmail-procmail
148 :type 'boolean) 182 :type 'boolean)
149 183
150 (defcustom nnmail-procmail-directory "~/incoming/" 184 (defcustom nnmail-procmail-directory "~/incoming/"
151 "*When using procmail (and the like), incoming mail is put in this directory. 185 "*When using procmail (and the like), incoming mail is put in this directory.
152 The Gnus mail backends will read the mail from this directory." 186 The Gnus mail backends will read the mail from this directory."
153 :group 'gnus-mail 187 :group 'nnmail-procmail
154 :type 'directory) 188 :type 'directory)
155 189
156 (defcustom nnmail-procmail-suffix "\\.spool" 190 (defcustom nnmail-procmail-suffix "\\.spool"
157 "*Suffix of files created by procmail (and the like). 191 "*Suffix of files created by procmail (and the like).
158 This variable might be a suffix-regexp to match the suffixes of 192 This variable might be a suffix-regexp to match the suffixes of
159 several files - eg. \".spool[0-9]*\"." 193 several files - eg. \".spool[0-9]*\"."
160 :group 'gnus-mail 194 :group 'nnmail-procmail
161 :type 'regexp) 195 :type 'regexp)
162 196
163 (defcustom nnmail-resplit-incoming nil 197 (defcustom nnmail-resplit-incoming nil
164 "*If non-nil, re-split incoming procmail sorted mail." 198 "*If non-nil, re-split incoming procmail sorted mail."
165 :group 'gnus-mail 199 :group 'nnmail-procmail
166 :type 'boolean) 200 :type 'boolean)
167 201
168 (defcustom nnmail-delete-file-function 'delete-file 202 (defcustom nnmail-delete-file-function 'delete-file
169 "Function called to delete files in some mail backends." 203 "Function called to delete files in some mail backends."
170 :group 'gnus-mail 204 :group 'nnmail-files
171 :type 'function) 205 :type 'function)
172 206
173 (defcustom nnmail-crosspost-link-function 'add-name-to-file 207 (defcustom nnmail-crosspost-link-function 'add-name-to-file
174 "Function called to create a copy of a file. 208 "Function called to create a copy of a file.
175 This is `add-name-to-file' by default, which means that crossposts 209 This is `add-name-to-file' by default, which means that crossposts
176 will use hard links. If your file system doesn't allow hard 210 will use hard links. If your file system doesn't allow hard
177 links, you could set this variable to `copy-file' instead." 211 links, you could set this variable to `copy-file' instead."
178 :group 'gnus-mail 212 :group 'nnmail-files
179 :type '(radio (function-item add-name-to-file) 213 :type '(radio (function-item add-name-to-file)
180 (function-item copy-file) 214 (function-item copy-file)
181 (function :tag "Other"))) 215 (function :tag "Other")))
182 216
183 (defcustom nnmail-movemail-program "movemail" 217 (defcustom nnmail-movemail-program "movemail"
185 The default is \"movemail\". 219 The default is \"movemail\".
186 220
187 This can also be a function. In that case, the function will be 221 This can also be a function. In that case, the function will be
188 called with two parameters -- the name of the INBOX file, and the file 222 called with two parameters -- the name of the INBOX file, and the file
189 to be moved to." 223 to be moved to."
190 :group 'gnus-mail 224 :group 'nnmail-files
225 :group 'nnmail-retrieve
191 :type 'string) 226 :type 'string)
192 227
193 (defcustom nnmail-pop-password-required nil 228 (defcustom nnmail-pop-password-required nil
194 "*Non-nil if a password is required when reading mail using POP." 229 "*Non-nil if a password is required when reading mail using POP."
195 :group 'gnus-mail 230 :group 'nnmail-retrieve
196 :type 'boolean) 231 :type 'boolean)
197 232
198 (defcustom nnmail-read-incoming-hook 233 (defcustom nnmail-read-incoming-hook
199 (if (eq system-type 'windows-nt) 234 (if (eq system-type 'windows-nt)
200 '(nnheader-ms-strip-cr) 235 '(nnheader-ms-strip-cr)
222 (lambda () 257 (lambda ()
223 ;; Update the displayed time, since that will clear out 258 ;; Update the displayed time, since that will clear out
224 ;; the flag that says you have mail. 259 ;; the flag that says you have mail.
225 (when (eq (process-status \"display-time\") 'run) 260 (when (eq (process-status \"display-time\") 'run)
226 (display-time-filter display-time-process \"\"))))" 261 (display-time-filter display-time-process \"\"))))"
227 :group 'gnus-mail 262 :group 'nnmail-prepare
228 :type 'hook) 263 :type 'hook)
229 264
230 ;; Suggested by Erik Selberg <speed@cs.washington.edu>. 265 ;; Suggested by Erik Selberg <speed@cs.washington.edu>.
231 (defcustom nnmail-prepare-incoming-hook nil 266 (defcustom nnmail-prepare-incoming-hook nil
232 "Hook called before treating incoming mail. 267 "Hook called before treating incoming mail.
233 The hook is run in a buffer with all the new, incoming mail." 268 The hook is run in a buffer with all the new, incoming mail."
234 :group 'gnus-mail 269 :group 'nnmail-prepare
235 :type 'hook) 270 :type 'hook)
236 271
237 (defcustom nnmail-prepare-incoming-header-hook nil 272 (defcustom nnmail-prepare-incoming-header-hook nil
238 "Hook called narrowed to the headers of each message. 273 "Hook called narrowed to the headers of each message.
239 This can be used to remove excessive spaces (and stuff like 274 This can be used to remove excessive spaces (and stuff like
240 that) from the headers before splitting and saving the messages." 275 that) from the headers before splitting and saving the messages."
241 :group 'gnus-mail 276 :group 'nnmail-prepare
242 :type 'hook) 277 :type 'hook)
243 278
244 (defcustom nnmail-prepare-incoming-message-hook nil 279 (defcustom nnmail-prepare-incoming-message-hook nil
245 "Hook called narrowed to each message." 280 "Hook called narrowed to each message."
246 :group 'gnus-mail 281 :group 'nnmail-prepare
247 :type 'hook) 282 :type 'hook)
248 283
249 (defcustom nnmail-list-identifiers nil 284 (defcustom nnmail-list-identifiers nil
250 "Regexp that matches list identifiers to be removed. 285 "Regexp that matches list identifiers to be removed.
251 This can also be a list of regexps." 286 This can also be a list of regexps."
252 :group 'gnus-mail 287 :group 'nnmail-prepare
253 :type '(choice regexp 288 :type '(choice (const :tag "none" nil)
289 regexp
254 (repeat regexp))) 290 (repeat regexp)))
255 291
256 (defcustom nnmail-pre-get-new-mail-hook nil 292 (defcustom nnmail-pre-get-new-mail-hook nil
257 "Hook called just before starting to handle new incoming mail." 293 "Hook called just before starting to handle new incoming mail."
258 :group 'gnus-mail 294 :group 'nnmail-retrieve
259 :type 'hook) 295 :type 'hook)
260 296
261 (defcustom nnmail-post-get-new-mail-hook nil 297 (defcustom nnmail-post-get-new-mail-hook nil
262 "Hook called just after finishing handling new incoming mail." 298 "Hook called just after finishing handling new incoming mail."
263 :group 'gnus-mail 299 :group 'nnmail-retrieve
264 :type 'hook) 300 :type 'hook)
265 301
266 (defcustom nnmail-split-hook nil 302 (defcustom nnmail-split-hook nil
267 "Hook called before deciding where to split an article. 303 "Hook called before deciding where to split an article.
268 The functions in this hook are free to modify the buffer 304 The functions in this hook are free to modify the buffer
269 contents in any way they choose -- the buffer contents are 305 contents in any way they choose -- the buffer contents are
270 discarded after running the split process." 306 discarded after running the split process."
271 :group 'gnus-mail 307 :group 'nnmail-split
272 :type 'hook) 308 :type 'hook)
273 309
274 ;; Suggested by Mejia Pablo J <pjm9806@usl.edu>. 310 ;; Suggested by Mejia Pablo J <pjm9806@usl.edu>.
275 (defcustom nnmail-tmp-directory nil 311 (defcustom nnmail-tmp-directory nil
276 "*If non-nil, use this directory for temporary storage when reading incoming mail." 312 "*If non-nil, use this directory for temporary storage.
277 :group 'gnus-mail 313 Used when reading incoming mail."
314 :group 'nnmail-files
315 :group 'nnmail-retrieve
278 :type '(choice (const :tag "default" nil) 316 :type '(choice (const :tag "default" nil)
279 (directory :format "%v"))) 317 (directory :format "%v")))
280 318
281 (defcustom nnmail-large-newsgroup 50 319 (defcustom nnmail-large-newsgroup 50
282 "*The number of the articles which indicates a large newsgroup. 320 "*The number of the articles which indicates a large newsgroup.
283 If the number of the articles is greater than the value, verbose 321 If the number of the articles is greater than the value, verbose
284 messages will be shown to indicate the current status." 322 messages will be shown to indicate the current status."
285 :group 'gnus-mail 323 :group 'nnmail-various
286 :type 'integer) 324 :type 'integer)
287 325
288 (defcustom nnmail-split-fancy "mail.misc" 326 (defcustom nnmail-split-fancy "mail.misc"
289 "Incoming mail can be split according to this fancy variable. 327 "Incoming mail can be split according to this fancy variable.
290 To enable this, set `nnmail-split-methods' to `nnmail-split-fancy'. 328 To enable this, set `nnmail-split-methods' to `nnmail-split-fancy'.
336 (any \"SmartList@informatik\\\\.rwth-aachen\\\\.de\" \"SmartList.list\") 374 (any \"SmartList@informatik\\\\.rwth-aachen\\\\.de\" \"SmartList.list\")
337 ;; People... 375 ;; People...
338 (any \"larsi@ifi\\\\.uio\\\\.no\" \"people.Lars Magne Ingebrigtsen\")) 376 (any \"larsi@ifi\\\\.uio\\\\.no\" \"people.Lars Magne Ingebrigtsen\"))
339 ;; Unmatched mail goes to the catch all group. 377 ;; Unmatched mail goes to the catch all group.
340 \"misc.misc\"))" 378 \"misc.misc\"))"
341 :group 'gnus-mail 379 :group 'nnmail-split
342 ;; Sigh! 380 ;; Sigh!
343 :type 'sexp) 381 :type 'sexp)
344 382
345 (defcustom nnmail-split-abbrev-alist 383 (defcustom nnmail-split-abbrev-alist
346 '((any . "from\\|to\\|cc\\|sender\\|apparently-to\\|resent-from\\|resent-to\\|resent-cc") 384 '((any . "from\\|to\\|cc\\|sender\\|apparently-to\\|resent-from\\|resent-to\\|resent-cc")
347 (mail . "mailer-daemon\\|postmaster\\|uucp")) 385 (mail . "mailer-daemon\\|postmaster\\|uucp"))
348 "Alist of abbreviations allowed in `nnmail-split-fancy'." 386 "Alist of abbreviations allowed in `nnmail-split-fancy'."
349 :group 'gnus-mail 387 :group 'nnmail-split
350 :type '(repeat (cons :format "%v" symbol regexp))) 388 :type '(repeat (cons :format "%v" symbol regexp)))
351 389
352 (defcustom nnmail-delete-incoming t 390 (defcustom nnmail-delete-incoming t
353 "*If non-nil, the mail backends will delete incoming files after 391 "*If non-nil, the mail backends will delete incoming files after
354 splitting." 392 splitting."
355 :group 'gnus-mail 393 :group 'nnmail-retrieve
356 :type 'boolean) 394 :type 'boolean)
357 395
358 (defcustom nnmail-message-id-cache-length 1000 396 (defcustom nnmail-message-id-cache-length 1000
359 "*The approximate number of Message-IDs nnmail will keep in its cache. 397 "*The approximate number of Message-IDs nnmail will keep in its cache.
360 If this variable is nil, no checking on duplicate messages will be 398 If this variable is nil, no checking on duplicate messages will be
361 performed." 399 performed."
362 :group 'gnus-mail 400 :group 'nnmail-duplicate
363 :type '(choice (const :tag "disable" nil) 401 :type '(choice (const :tag "disable" nil)
364 (integer :format "%v"))) 402 (integer :format "%v")))
365 403
366 (defcustom nnmail-message-id-cache-file "~/.nnmail-cache" 404 (defcustom nnmail-message-id-cache-file "~/.nnmail-cache"
367 "*The file name of the nnmail Message-ID cache." 405 "*The file name of the nnmail Message-ID cache."
368 :group 'gnus-mail 406 :group 'nnmail-duplicate
407 :group 'nnmail-files
369 :type 'file) 408 :type 'file)
370 409
371 (defcustom nnmail-treat-duplicates 'warn 410 (defcustom nnmail-treat-duplicates 'warn
372 "*If non-nil, nnmail keep a cache of Message-IDs to discover mail duplicates. 411 "*If non-nil, nnmail keep a cache of Message-IDs to discover mail duplicates.
373 Three values are legal: nil, which means that nnmail is not to keep a 412 Three values are legal: nil, which means that nnmail is not to keep a
376 and `delete', which means that nnmail will delete duplicated mails. 415 and `delete', which means that nnmail will delete duplicated mails.
377 416
378 This variable can also be a function. It will be called from a buffer 417 This variable can also be a function. It will be called from a buffer
379 narrowed to the article in question with the Message-ID as a 418 narrowed to the article in question with the Message-ID as a
380 parameter. It should return nil, `warn' or `delete'." 419 parameter. It should return nil, `warn' or `delete'."
381 :group 'gnus-mail 420 :group 'nnmail-duplicate
382 :type '(choice (const :tag "off" nil) 421 :type '(choice (const :tag "off" nil)
383 (const warn) 422 (const warn)
384 (const delete))) 423 (const delete)))
385 424
386 ;;; Internal variables. 425 ;;; Internal variables.
1471 (nnmail-make-complex-temp-name 1510 (nnmail-make-complex-temp-name
1472 (expand-file-name 1511 (expand-file-name
1473 (if nnmail-tmp-directory 1512 (if nnmail-tmp-directory
1474 (concat 1513 (concat
1475 (file-name-as-directory nnmail-tmp-directory) 1514 (file-name-as-directory nnmail-tmp-directory)
1476 (file-name-nondirectory (concat temp "Incoming"))) 1515 (file-name-nondirectory
1477 (concat temp "Incoming"))))) 1516 (concat (file-name-as-directory temp) "Incoming")))
1517 (concat (file-name-as-directory temp) "Incoming")))))
1478 (rename-file nnmail-crash-box incoming t) 1518 (rename-file nnmail-crash-box incoming t)
1479 (push incoming incomings)))) 1519 (push incoming incomings))))
1480 ;; If we did indeed read any incoming spools, we save all info. 1520 ;; If we did indeed read any incoming spools, we save all info.
1481 (when incomings 1521 (when incomings
1482 (nnmail-save-active 1522 (nnmail-save-active
1630 (while his 1670 (while his
1631 (when (assoc group (pop his)) 1671 (when (assoc group (pop his))
1632 (setq found t 1672 (setq found t
1633 his nil))) 1673 his nil)))
1634 found)) 1674 found))
1635 1675
1676 (defun nnmail-pop3-movemail (inbox crashbox)
1677 "Function to move mail from INBOX on a pop3 server to file CRASHBOX."
1678 (require 'pop3)
1679 (let ((pop3-maildrop
1680 (substring inbox (match-end (string-match "^po:" inbox)))))
1681 (pop3-movemail crashbox)))
1682
1636 (run-hooks 'nnmail-load-hook) 1683 (run-hooks 'nnmail-load-hook)
1637 1684
1638 (provide 'nnmail) 1685 (provide 'nnmail)
1639 1686
1640 ;;; nnmail.el ends here 1687 ;;; nnmail.el ends here