From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/53279 Path: main.gmane.org!not-for-mail From: Florian Weimer Newsgroups: gmane.emacs.gnus.general Subject: nnmail-split-fancy usability problem Date: Sun, 29 Jun 2003 13:27:53 +0200 Sender: ding-owner@lists.math.uh.edu Message-ID: <87u1a9jf7q.fsf@deneb.enyo.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1056886116 15231 80.91.224.249 (29 Jun 2003 11:28:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 29 Jun 2003 11:28:36 +0000 (UTC) Original-X-From: ding-owner+M1823@lists.math.uh.edu Sun Jun 29 13:28:34 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19WaME-0003xT-00 for ; Sun, 29 Jun 2003 13:28:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 19WaLm-0002jg-00; Sun, 29 Jun 2003 06:28:07 -0500 Original-Received: from sclp3.sclp.com ([64.157.176.121]) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 19WaLd-0002jY-00 for ding@lists.math.uh.edu; Sun, 29 Jun 2003 06:27:57 -0500 Original-Received: (qmail 64206 invoked by alias); 29 Jun 2003 11:27:57 -0000 Original-Received: (qmail 64201 invoked from network); 29 Jun 2003 11:27:56 -0000 Original-Received: from gw.enyo.de (HELO mail.enyo.de) (212.9.189.178) by sclp3.sclp.com with SMTP; 29 Jun 2003 11:27:56 -0000 Original-Received: from [212.9.189.171] (helo=deneb.enyo.de) by mail.enyo.de with esmtp (Exim 4.20) id 19WaLa-00006h-32 for ding@gnus.org; Sun, 29 Jun 2003 13:27:54 +0200 Original-Received: from fw by deneb.enyo.de with local (Exim 4.20) id 19WaLZ-0000IW-Vk for ding@gnus.org; Sun, 29 Jun 2003 13:27:53 +0200 Original-To: ding@gnus.org Mail-Followup-To: ding@gnus.org User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:53279 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:53279 Let's say we have list postings with the following header: List-Id: An example list Say we want to use a generic rule which processes all lists at example.com. The following doesn't work because "<" is not a word constituent: ("List-Id" "<\\([a-z0-9-]+\\)\\.example\\.com>" "lists.example.\\1") This doesn't work either because ".*" is greedy. ("List-Id" ".*\\([a-z0-9-]+\\)\\.example\\.com" "lists.example.\\1") After rewriting, this results in an illegal regular expression (".*" at the beginning is dropped unconditionally). ("List-Id" ".*?\\([a-z0-9-]+\\)\\.example\\.com" "lists.example.\\1") Fortunately, the rule below works because the initial ".*" suppresses the word constituent check: ("List-Id" ".*<\\([a-z0-9-]+\\)\\.example\\.com>.*" "lists.example.\\1") However, we are a bit lucky. If there weren't the "<" character as a marker, I think we would have a hard time working around the greedy ".*" in the header field matcher. The following patch changes the implicit ".*" to ".*?". Okay to apply? (However, IMHO, the whole behavior of nnmail-split-fancy is highly non-intuitive.) 2003-06-29 Florian Weimer * nnmail.el (nnmail-split-it): Make header field match non-greedy. --- nnmail.el.~6.77.~ 2003-06-29 12:50:50.000000000 +0200 +++ nnmail.el 2003-06-29 13:19:13.000000000 +0200 @@ -1306,7 +1306,7 @@ (push split nnmail-split-trace)) (let ((split-rest (cddr split)) (end (match-end 0)) - ;; The searched regexp is \(\(FIELD\).*\)\(VALUE\). + ;; The searched regexp is \(\(FIELD\).*?\)\(VALUE\). ;; So, start-of-value is the point just before the ;; beginning of the value, whereas after-header-name ;; is the point just after the field name. @@ -1366,7 +1366,7 @@ (if (symbolp field) (cdr (assq field nnmail-split-abbrev-alist)) field) - "\\):.*\\)" + "\\):.*?\\)" (or partial-front "\\<") "\\(" value