From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/12661 Path: main.gmane.org!not-for-mail From: Tonny Madsen Newsgroups: gmane.emacs.gnus.general Subject: Adding new nnmail-split-fancy construct Date: 22 Oct 1997 10:35:32 +0200 Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no Content-Type: text X-Trace: main.gmane.org 1035152157 4987 80.91.224.250 (20 Oct 2002 22:15:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 22:15:57 +0000 (UTC) Return-Path: Original-Received: from xemacs.org (xemacs.cs.uiuc.edu [128.174.252.16]) by altair.xemacs.org (8.8.7/8.8.7) with ESMTP id GAA17402 for ; Wed, 22 Oct 1997 06:25:31 -0700 Original-Received: from ifi.uio.no (0@ifi.uio.no [129.240.64.2]) by xemacs.org (8.8.5/8.8.5) with ESMTP id IAA19093 for ; Wed, 22 Oct 1997 08:27:18 -0500 (CDT) Original-Received: from claymore.vcinet.com (claymore.vcinet.com [208.205.12.23]) by ifi.uio.no (8.8.7/8.8.7/ifi0.2) with SMTP id OAA24234 for ; Wed, 22 Oct 1997 14:02:47 +0200 (MET DST) Original-Received: (qmail 4605 invoked by uid 504); 22 Oct 1997 12:02:46 -0000 Original-Received: (qmail 4602 invoked from network); 22 Oct 1997 12:02:45 -0000 Original-Received: from garbo.DK.net (uucp@193.88.44.23) by claymore.vcinet.com with SMTP; 22 Oct 1997 12:02:44 -0000 Original-Received: (from uucp@localhost) by garbo.DK.net (8.8.5/8.6.12) id OAA24035 for ding@gnus.org; Wed, 22 Oct 1997 14:02:35 +0200 (MET DST) >Received: from balder.elmi.dk by gandalf.nettest.dk (4.1/DKnet2.0.8) for ding@gnus.org; id AA12352; Wed, 22 Oct 97 10:30:29 +0200 Original-Received: from balder.elmi.dk by gandalf.nettest.dk (4.1/DKnet2.0.8) for ding@gnus.org; id AA12352; Wed, 22 Oct 97 10:30:29 +0200 Original-Received: by balder.elmi.dk (SMI-8.6/SMI-SVR4) id KAA02535; Wed, 22 Oct 1997 10:35:33 +0200 Original-To: ding@gnus.org Original-Lines: 51 X-Mailer: Gnus v5.4.64/XEmacs 20.3(beta17) - "Bucharest" Xref: main.gmane.org gmane.emacs.gnus.general:12661 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:12661 Hi' I occasionally need to split messages, by searching them directly for a regular expression. In most cases, though, it is simply to single out all messages, where the the subject line starting with a specific word. This cannot be done with the current nnmail-split-fancy variable and function. To deal with this I have added a catch-all split expression, (/ REGEXP SPLIT), that will use SPLIT if REGEXP matches the message. I would prefer a solution where one could specify that the header line must *start* with a specific regexp, but this was easier to implement. Note that the current implementation will convert the split expression ("subject" "patch" SPLIT) to the regexp ""^\\(\\(subject\\):.*\\)\\<\\(patch\\)\\>". This will match any subject, which includes the word 'patch'. I want to word to be the first word of the subject. /tonny Patch: --- nnmail.el~ Sun Jul 20 22:34:48 1997 +++ nnmail.el Wed Oct 22 10:18:19 1997 @@ -354,6 +354,9 @@ \(& SPLIT...): Process each SPLIT expression. +\(/ REGEXP SPLIT): If the message matches REGEXP, store the messages + as specified by SPLIT. + \(: FUNCTION optional args): Call FUNCTION with the optional args, in the buffer containing the message headers. The return value FUNCTION should be a split, which is then recursively processed. @@ -1210,6 +1213,13 @@ ;; Builtin : operation. ((eq (car split) ':) (nnmail-split-it (eval (cdr split)))) + + ;; Builtin / operation. + ((eq (car split) '/) + (goto-char (point-max)) + ;; Same problems as specified for the next condition. + (when (re-search-backward (nth 1 split) nil t) + (nnmail-split-it (nth 2 split)))) ;; Check the cache for the regexp for this split. ;; FIX FIX FIX could avoid calling assq twice here