From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/23808 Path: main.gmane.org!not-for-mail From: Alexandre Oliva Newsgroups: gmane.emacs.gnus.general Subject: Re: RESTRICT for splits: (FIELD VALUE [- RESTRICT [...]] SPLIT) Date: 04 Jul 1999 23:37:43 -0300 Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035161475 4049 80.91.224.250 (21 Oct 2002 00:51:15 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 00:51:15 +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 XAA01853 for ; Sun, 4 Jul 1999 23:07:14 -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 WAB00120; Sun, 4 Jul 1999 22:06:46 -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 22:07:34 -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 WAA28771 for ; Sun, 4 Jul 1999 22:07:16 -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 XAA01831 for ; Sun, 4 Jul 1999 23:06:08 -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 XAA15034 for ; Sun, 4 Jul 1999 23:33:55 -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 XAA07277 for ; Sun, 4 Jul 1999 23:33:56 -0300 (EST) Original-To: ding@gnus.org In-Reply-To: Alexandre Oliva's message of "04 Jul 1999 22:52:39 -0300" Original-Lines: 15 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:23808 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:23808 --=-=-= On Jul 4, 1999, Alexandre Oliva wrote: > However, because the multi-match feature is not included in this > patch, it may fail to handle certain cross-posting cases. And now, the multi-match feature. The patch was created ignoring blanks, so that it is more readable and its simplicity is clearer. -- 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=multi-match.patch Index: ChangeLog from Alexandre Oliva * nnmail.el (nnmail-split-it): Search the regexp multiple times, so that matches excluded by RESTRICTs do not cause the whole split to be ignored. This also fixes a long-standing bug in which a split with \N substitutions wouldn't cause cross-posting as expected. Index: nnmail.el =================================================================== RCS file: /home/phd/oliva/src/.cvs/src/emacs-lisp/nnmail.el,v retrieving revision 1.1.1.2.2.3 diff -u -b -r1.1.1.2.2.3 nnmail.el --- nnmail.el 1999/07/05 01:53:01 1.1.1.2.2.3 +++ nnmail.el 1999/07/05 02:02:59 @@ -1121,22 +1121,13 @@ ;; Check the cache for the regexp for this split. ((setq cached-pair (assq split nnmail-split-cache)) - (goto-char (point-max)) - ;; FIX FIX FIX problem with re-search-backward is that if you have - ;; a split: (from "foo-\\(bar\\|baz\\)@gnus.org "mail.foo.\\1") - ;; and someone mails a message with 'To: foo-bar@gnus.org' and - ;; 'CC: foo-baz@gnus.org', we'll pick 'mail.foo.baz' as the group - ;; if the cc line is a later header, even though the other choice - ;; is probably better. Also, this routine won't do a crosspost - ;; when there are two different matches. - ;; I guess you could just make this more determined, and it could - ;; look for still more matches prior to this one, and recurse - ;; on each of the multiple matches hit. Of course, then you'd - ;; want to make sure that nnmail-article-group or nnmail-split-fancy - ;; removed duplicates, since there might be more of those. - ;; I guess we could also remove duplicates in the & split case, since - ;; that's the only thing that can introduce them. - (when (re-search-backward (cdr cached-pair) nil t) + (let (split-result + (end-point (point-max)) + (value (nth 1 split))) + (if (symbolp value) + (setq value (cdr (assq value nnmail-split-abbrev-alist)))) + (while (and (goto-char end-point) + (re-search-backward (cdr cached-pair) nil t)) (when nnmail-split-tracing (push (cdr cached-pair) nnmail-split-trace)) (let ((split-rest (cddr split)) @@ -1147,6 +1138,9 @@ ;; the point just after the field name. (start-of-value (match-end 1)) (after-header-name (match-end 2))) + ;; Start the next search just before the beginning of the + ;; VALUE match. + (setq end-point (1- start-of-value)) ;; Handle - RESTRICTs (while (eq (car split-rest) '-) ;; RESTRICT must start after-header-name and @@ -1168,7 +1162,10 @@ ;; 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)))))) + (dolist (sp (nnmail-split-it (car split-rest))) + (unless (memq sp split-result) + (push sp split-result)))))) + split-result)) ;; Not in cache, compute a regexp for the field/value pair. (t --=-=-=--