1 |
;;; gnus-mlspl.el --- a group params-based mail splitting mechanism |
;;; gnus-mlspl.el --- a group params-based mail splitting mechanism |
2 |
;; Copyright (C) 1998, 1999, 2000 |
|
3 |
|
;; Copyright (C) 1998, 1999, 2000, 2001, 2002 |
4 |
;; Free Software Foundation, Inc. |
;; Free Software Foundation, Inc. |
5 |
|
|
6 |
;; Author: Alexandre Oliva <oliva@lsd.ic.unicamp.br> |
;; Author: Alexandre Oliva <oliva@lsd.ic.unicamp.br> |
9 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
10 |
|
|
11 |
;; GNU Emacs is free software; you can redistribute it and/or modify |
;; GNU Emacs is free software; you can redistribute it and/or modify |
12 |
;; it under the terms of the GNU General Public License as published by |
;; it under the terms of the GNU General Public License as published |
13 |
;; the Free Software Foundation; either version 2, or (at your option) |
;; by the Free Software Foundation; either version 2, or (at your |
14 |
;; any later version. |
;; option) any later version. |
15 |
|
|
16 |
;; GNU Emacs is distributed in the hope that it will be useful, |
;; GNU Emacs is distributed in the hope that it will be useful, but |
17 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
;; WITHOUT ANY WARRANTY; without even the implied warranty of |
18 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 |
;; GNU General Public License for more details. |
;; General Public License for more details. |
20 |
|
|
21 |
;; You should have received a copy of the GNU General Public License |
;; You should have received a copy of the GNU General Public License |
22 |
;; along with GNU Emacs; see the file COPYING. If not, write to the |
;; along with this program; see the file COPYING. If not, write to |
23 |
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
24 |
;; Boston, MA 02111-1307, USA. |
;; Boston, MA 02111-1307, USA. |
25 |
|
|
26 |
;;; Commentary: |
;;; Commentary: |
63 |
uses are as simple as the name of a default mail group, but more |
uses are as simple as the name of a default mail group, but more |
64 |
elaborate fancy splits may also be useful to split mail that doesn't |
elaborate fancy splits may also be useful to split mail that doesn't |
65 |
match any of the group-specified splitting rules. See |
match any of the group-specified splitting rules. See |
66 |
gnus-group-split-fancy for details." |
`gnus-group-split-fancy' for details." |
67 |
(interactive "P") |
(interactive "P") |
68 |
(setq nnmail-split-methods 'nnmail-split-fancy) |
(setq nnmail-split-methods 'nnmail-split-fancy) |
69 |
(when catch-all |
(when catch-all |
89 |
;;;###autoload |
;;;###autoload |
90 |
(defun gnus-group-split () |
(defun gnus-group-split () |
91 |
"Uses information from group parameters in order to split mail. |
"Uses information from group parameters in order to split mail. |
92 |
See gnus-group-split-fancy for more information. |
See `gnus-group-split-fancy' for more information. |
93 |
|
|
94 |
gnus-group-split is a valid value for nnmail-split-methods." |
gnus-group-split is a valid value for nnmail-split-methods." |
95 |
(let (nnmail-split-fancy) |
(let (nnmail-split-fancy) |
141 |
nnml:mail.others: |
nnml:mail.others: |
142 |
\((split-spec . catch-all)) |
\((split-spec . catch-all)) |
143 |
|
|
144 |
Calling (gnus-group-split-fancy nil nil \"mail.misc\") returns: |
Calling (gnus-group-split-fancy nil nil \"mail.others\") returns: |
145 |
|
|
146 |
\(| (& (any \"\\\\(bar@femail\\\\.com\\\\|.*@femail\\\\.com\\\\)\" |
\(| (& (any \"\\\\(bar@femail\\\\.com\\\\|.*@femail\\\\.com\\\\)\" |
147 |
\"mail.bar\") |
\"mail.bar\") |
148 |
(any \"\\\\(foo@nowhere\\\\.gov\\\\|foo@localhost\\\\|foo-redist@home\\\\)\" |
(any \"\\\\(foo@nowhere\\\\.gov\\\\|foo@localhost\\\\|foo-redist@home\\\\)\" |
149 |
- \"bugs-foo\" - \"rambling-foo\" \"mail.foo\")) |
- \"bugs-foo\" - \"rambling-foo\" \"mail.foo\")) |
150 |
\"mail.others\")" |
\"mail.others\")" |
151 |
(let* ((newsrc (cdr gnus-newsrc-alist)) |
(let* ((newsrc (cdr gnus-newsrc-alist)) |
152 |
split) |
split) |
203 |
(list 'any split-regexp) |
(list 'any split-regexp) |
204 |
;; Generate RESTRICTs for SPLIT-EXCLUDEs. |
;; Generate RESTRICTs for SPLIT-EXCLUDEs. |
205 |
(if (listp split-exclude) |
(if (listp split-exclude) |
206 |
(let ((seq split-exclude) |
(apply #'append |
207 |
res) |
(mapcar (lambda (arg) (list '- arg)) |
208 |
(while seq |
split-exclude)) |
|
(push (cons '- (pop seq)) |
|
|
res)) |
|
|
(apply #'nconc (nreverse res))) |
|
209 |
(list '- split-exclude)) |
(list '- split-exclude)) |
210 |
(list group-clean)) |
(list group-clean)) |
211 |
split) |
split) |