From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/79245 Path: news.gmane.org!not-for-mail From: lee Newsgroups: gmane.emacs.gnus.general Subject: Re: checking several headers when splitting mail Date: Tue, 28 Jun 2011 23:21:04 +0200 Organization: my virtual residence Message-ID: <87iprp3b5r.fsf@yun.yagibdah.de> References: <87zkliev2l.fsf@yun.yagibdah.de> <87y612kh0o.fsf@member.fsf.org> <8739iulz7p.fsf@lifelogs.com> <87vcvpkcf4.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1309296194 21169 80.91.229.12 (28 Jun 2011 21:23:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 28 Jun 2011 21:23:14 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M27540@lists.math.uh.edu Tue Jun 28 23:23:07 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QbfkM-0005w5-0Q for ding-account@gmane.org; Tue, 28 Jun 2011 23:23:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1QbfiZ-0007xq-1e; Tue, 28 Jun 2011 16:21:11 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1QbfiX-0007xi-FG for ding@lists.math.uh.edu; Tue, 28 Jun 2011 16:21:09 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1QbfiV-000261-Rt for ding@lists.math.uh.edu; Tue, 28 Jun 2011 16:21:08 -0500 Original-Received: from static.73.179.46.78.clients.your-server.de ([78.46.179.73]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1QbfiT-0007h3-Tc for ding@gnus.org; Tue, 28 Jun 2011 23:21:06 +0200 Original-Received: from lee by yun.yagibdah.de with local (Exim 4.76) (envelope-from ) id 1QbfiT-0007wb-0b for ding@gnus.org; Tue, 28 Jun 2011 23:21:05 +0200 Mail-Followup-To: ding@gnus.org In-Reply-To: <87vcvpkcf4.fsf@lifelogs.com> (Ted Zlatanov's message of "Tue, 28 Jun 2011 14:01:51 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin (3.3.1 2010-03-16) analysis follows Bayesian score: 0.0000 Ham tokens: 0.000-1847--5992h-0s--0d--H*u:Emacs, 0.000-1715--5563h-0s--0d--H*u:Gnus, 0.000-1646--5339h-0s--0d--H*u:linux, 0.000-1646--5339h-0s--0d--H*UA:linux, 0.000-1595--5173h-0s--0d--H*UA:gnu Spam tokens: 0.987-1--0h-1s--0d--H*r:sk:clients, 0.957-4206--1389h-52036s--0d--H*r:quimby.gnus.org, 0.925-242--193h-4041s--0d--H*r:sk:static., 0.882-1507--4120h-52329s--0d--HX-Spam-Relays-External:quimby.gnus.org, 0.882-1507--4120h-52329s--0d--H*RU:quimby.gnus.org Autolearn status: no -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 2.0 HELO_DYNAMIC_IPADDR Relay HELO'd using suspicious hostname (IP addr 1) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:79245 Archived-At: Ted Zlatanov writes: > On Tue, 28 Jun 2011 20:04:58 +0200 Andreas Schwab wrote: > > AS> Ted Zlatanov writes: >>> On Wed, 15 Jun 2011 22:42:33 +0200 Andreas Schwab wrote: >>> > AS> You either need to make ?+ a word character in > AS> nnmail-split-fancy-syntax-table, or use ".*\\+491234567". >>> >>> Could you show an example? > > AS> Read the doc string of modify-syntax-entry. > > So, for those who are interested, it's useful to test fancy splits like > this: > > #+begin_src lisp > (let ((mytable (copy-syntax-table nnmail-split-fancy-syntax-table))) > (when (with-syntax-table mytable > (string-match "\\ (message "Matches without modification")) > (modify-syntax-entry ?/ "w" mytable) > (when (with-syntax-table mytable > (string-match "\\ (message "Matches with modification"))) > > #+end_src > > Would that be useful in the manual as a demonstration of what a word > character will do? Hm, I guess so. Adding a reference to some documentation about what a syntax-table is would be useful, too. > Now for the next questions: is there any downside to modifying > `nnmail-split-fancy-syntax-table'? And why does ".*\\+491234567" work? > What exactly are we looking at to match against the regular expression, > in other words, and why does that match when the regular expression is > ".*\\+491234567" but not otherwise? And another question: My very first attempt to modify an elisp program looks like this: #+begin_src lisp (let ( (mytable (copy-syntax-table nnmail-split-fancy-syntax-table)) (mstrg "/var/log")) (when (with-syntax-table mytable (string-match (concat "\\<" mstrg) mstrg)) (message "'%s' matches '%s'without modification" (concat "\\<" mstrg) mstrg)) (modify-syntax-entry ?/ "w" mytable) (when (with-syntax-table mytable (string-match (concat "\\<" mstrg) mstrg)) (message "'%s' matches '%s' without modification" (concat "\\<" mstrg) mstrg))) #+end_src ... and it gives different results for the matching than your code does. Why? My idea was to eventually make it a function that can be bound to a key. That could be useful when working on splitting rules. Isn't there a way to make these splitting rules easier so that people who don't speak elisp can understand how to create them? Something like if $h_From: matches root@localhost then if $h_Subject: matches "/var/log/.*" then save "mail.localhost.sys" endif endif ... won't even need (much) explanation. Exim does it like this in its .forward files[1]. [1]: http://www.exim.org/exim-html-current/doc/html/spec_html/filter_ch03.html