From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/23805 Path: main.gmane.org!not-for-mail From: Alexandre Oliva Newsgroups: gmane.emacs.gnus.general Subject: RESTRICT for splits: (FIELD VALUE [- RESTRICT [...]] SPLIT) Date: 04 Jul 1999 22:52:39 -0300 Sender: owner-ding@hpc.uh.edu Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035161473 4039 80.91.224.250 (21 Oct 2002 00:51:13 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 00:51:13 +0000 (UTC) Return-Path: Original-Received: from farabi.math.uh.edu (farabi.math.uh.edu [129.7.128.57]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id VAA01224 for ; Sun, 4 Jul 1999 21:57:56 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by farabi.math.uh.edu (8.9.1/8.9.1) with ESMTP id UAB29646; Sun, 4 Jul 1999 20:53:59 -0500 (CDT) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sun, 04 Jul 1999 20:54:47 -0500 (CDT) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id UAA28368 for ; Sun, 4 Jul 1999 20:54:34 -0500 (CDT) Original-Received: from grande.dcc.unicamp.br (grande.dcc.unicamp.br [143.106.1.11]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id VAA01175 for ; Sun, 4 Jul 1999 21:53:02 -0400 (EDT) Original-Received: from amazonas.dcc.unicamp.br (amazonas.dcc.unicamp.br [143.106.7.11]) by grande.dcc.unicamp.br (8.9.1/8.9.1) with ESMTP id WAA14734 for ; Sun, 4 Jul 1999 22:48:52 -0300 (EST) Original-Received: from cupuacu.lsd.dcc.unicamp.br (oliva@cupuacu.lsd.dcc.unicamp.br [143.106.24.145]) by amazonas.dcc.unicamp.br (8.8.5/8.8.5) with SMTP id WAA03924 for ; Sun, 4 Jul 1999 22:48:50 -0300 (EST) Original-To: ding@gnus.org Original-Lines: 24 User-Agent: Gnus/5.070091 (Pterodactyl Gnus v0.91) XEmacs/20.4 (Emerald) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:23805 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:23805 --=-=-= This is a new implementation of RESTRICT clauses in fancy splits. It's much simpler than the one I posted before, but it's reasonably easy to prove that, if restricts are not used, it is equivalent to the currently installed code. However, because the multi-match feature is not included in this patch, it may fail to handle certain cross-posting cases. For example, if the split is `(any "foo"- "x-foo" "foo.list")' and the header line that first matches `foo' is: `To: foo, x-foo', this split won't be used, because `x-foo' will be matched and restrict will match, but no other occurrences of `foo' will be looked for. The patch for the lisp code is the first attachment. The second attachment is a re-post of the patch for the .texi documentation. -- Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il {oliva,Alexandre.Oliva}@dcc.unicamp.br aoliva@{acm.org,computer.org} oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org} *** E-mail about software projects will be forwarded to mailing lists --=-=-= Content-Type: application/x-patch Content-Disposition: attachment; filename=restrict.patch Index: ChangeLog from Alexandre Oliva * nnmail.el (nnmail-split-fancy): Document RESTRICT clauses. (nnmail-split-it): Implement them. Index: nnmail.el =================================================================== RCS file: /home/phd/oliva/src/.cvs/src/emacs-lisp/nnmail.el,v retrieving revision 1.1.1.2.2.2 diff -u -r1.1.1.2.2.2 nnmail.el --- nnmail.el 1999/07/05 00:32:29 1.1.1.2.2.2 +++ nnmail.el 1999/07/05 01:44:03 @@ -293,8 +293,12 @@ GROUP: Mail will be stored in GROUP (a string). -\(FIELD VALUE SPLIT): If the message field FIELD (a regexp) contains - VALUE (a regexp), store the messages as specified by SPLIT. +\(FIELD VALUE [- RESTRICT [- RESTRICT [...]]] SPLIT): If the message + field FIELD (a regexp) contains VALUE (a regexp), store the messages + as specified by SPLIT. If RESTRICT (a regexp) matches some string + after FIELD and before the end of the matched VALUE, return NIL, + otherwise process SPLIT. Multiple RESTRICTs add up, further + restricting the possibility of processing SPLIT. \(| SPLIT...): Process each SPLIT expression until one of them matches. A SPLIT expression is said to match if it will cause the mail @@ -337,6 +341,13 @@ ;; Other mailing lists... (any \"procmail@informatik\\\\.rwth-aachen\\\\.de\" \"procmail.list\") (any \"SmartList@informatik\\\\.rwth-aachen\\\\.de\" \"SmartList.list\") + ;; Both lists below have the same suffix, so prevent + ;; cross-posting to mkpkg.list of messages posted only to + ;; the bugs- list, but allow cross-posting when the + ;; message was really cross-posted. + (any \"bugs-mypackage@somewhere\" \"mypkg.bugs\") + (any \"mypackage@somewhere\" - \"bugs-mypackage\" \"mypkg.list\") + ;; ;; People... (any \"larsi@ifi\\\\.uio\\\\.no\" \"people.Lars Magne Ingebrigtsen\")) ;; Unmatched mail goes to the catch all group. @@ -1128,15 +1139,36 @@ (when (re-search-backward (cdr cached-pair) nil t) (when nnmail-split-tracing (push (cdr cached-pair) nnmail-split-trace)) - ;; Someone might want to do a \N sub on this match, so get the - ;; correct match positions. - (goto-char (match-end 0)) - (let ((value (nth 1 split))) - (re-search-backward (if (symbolp value) - (cdr (assq value nnmail-split-abbrev-alist)) - value) - (match-end 1))) - (nnmail-split-it (nth 2 split)))) + (let ((split-rest (cddr split)) + (end (match-end 0)) + ;; The searched regexp is \(\(FIELD\).*\)\(VALUE\). So, + ;; start-of-value is the the point just before the + ;; beginning of the value, whereas after-header-name is + ;; the point just after the field name. + (start-of-value (match-end 1)) + (after-header-name (match-end 2))) + ;; Handle - RESTRICTs + (while (eq (car split-rest) '-) + ;; RESTRICT must start after-header-name and + ;; end after start-of-value, so that, for + ;; (any "foo" - "x-foo" "foo.list") + ;; we do not exclude foo.list just because + ;; the header is: ``To: x-foo, foo'' + (goto-char end) + (if (and (re-search-backward (cadr split-rest) + after-header-name t) + (> (match-end 0) start-of-value)) + (setq split-rest nil) + (setq split-rest (cddr split-rest)))) + (when split-rest + (goto-char end) + (let ((value (nth 1 split))) + (if (symbolp value) + (setq value (cdr (assq value nnmail-split-abbrev-alist)))) + ;; Someone might want to do a \N sub on this match, so get the + ;; correct match positions. + (re-search-backward value start-of-value)) + (nnmail-split-it (car split-rest)))))) ;; Not in cache, compute a regexp for the field/value pair. (t --=-=-= Content-Type: application/x-patch Content-Disposition: attachment; filename=restrict-docs.patch Index: texi/ChangeLog from Alexandre Oliva * gnus.texi (Fancy Mail Splitting): Document RESTRICT. Index: texi/gnus.texi --- texi/gnus.texi Tue Jun 15 01:12:06 1999 +++ texi/gnus.texi Fri Jun 25 06:20:53 1999 @@ -10441,6 +10441,12 @@ ;; Other mailing lists... (any "procmail@@informatik\\.rwth-aachen\\.de" "procmail.list") (any "SmartList@@informatik\\.rwth-aachen\\.de" "SmartList.list") + ;; Both lists below have the same suffix, so prevent + ;; cross-posting to mkpkg.list of messages posted only to + ;; the bugs- list, but allow cross-posting when the + ;; message was really cross-posted. + (any "bugs-mypackage@@somewhere" "mypkg.bugs") + (any "mypackage@@somewhere\" - "bugs-mypackage" "mypkg.list") ;; People... (any "larsi@@ifi\\.uio\\.no" "people.Lars_Magne_Ingebrigtsen")) ;; Unmatched mail goes to the catch all group. @@ -10459,9 +10465,12 @@ examples. @item -@var{(FIELD VALUE SPLIT)}: If the split is a list, the first element of -which is a string, then store the message as specified by SPLIT, if -header FIELD (a regexp) contains VALUE (also a regexp). +@var{(FIELD VALUE [- RESTRICT [- RESTRICT [...]]] SPLIT)}: If the split +is a list, the first element of which is a string, then store the +message as specified by SPLIT, if header FIELD (a regexp) contains VALUE +(also a regexp). If RESTRICT (yet another regexp) matches some string +after FIELD and before the end of the matched VALUE, the SPLIT is +ignored. If none of the RESTRICT clauses match, SPLIT is processed. @item @var{(| SPLIT...)}: If the split is a list, and the first element is --=-=-=--