Gnus development mailing list
 help / color / mirror / Atom feed
From: lee <lee@yun.yagibdah.de>
To: ding@gnus.org
Subject: Re: checking several headers when splitting mail
Date: Tue, 28 Jun 2011 23:21:04 +0200	[thread overview]
Message-ID: <87iprp3b5r.fsf@yun.yagibdah.de> (raw)
In-Reply-To: <87vcvpkcf4.fsf@lifelogs.com> (Ted Zlatanov's message of "Tue, 28 Jun 2011 14:01:51 -0500")

Ted Zlatanov <tzz@lifelogs.com> writes:

> On Tue, 28 Jun 2011 20:04:58 +0200 Andreas Schwab <schwab@linux-m68k.org> wrote: 
>
> AS> Ted Zlatanov <tzz@lifelogs.com> writes:
>>> On Wed, 15 Jun 2011 22:42:33 +0200 Andreas Schwab <schwab@linux-m68k.org> 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 "\\</var/log" "/var/log"))
>     (message "Matches without modification"))
>   (modify-syntax-entry ?/ "w" mytable)
>   (when (with-syntax-table mytable
>           (string-match "\\</var/log" "/var/log"))
>     (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



  reply	other threads:[~2011-06-28 21:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 19:46 lee
2011-06-15 19:53 ` Tassilo Horn
2011-06-15 20:42   ` Andreas Schwab
2011-06-28 16:04     ` Ted Zlatanov
2011-06-28 18:04       ` Andreas Schwab
2011-06-28 19:01         ` Ted Zlatanov
2011-06-28 21:21           ` lee [this message]
2011-06-28 23:22             ` lee
2011-06-15 21:16   ` lee
2011-06-26  9:31 ` Lars Magne Ingebrigtsen
2011-06-26 19:00   ` lee
2011-06-26 19:26     ` Andreas Schwab
2011-06-27  0:53       ` lee
2011-06-27 22:40         ` Andreas Schwab
2011-06-28  1:00           ` lee
2011-06-28 18:03             ` Andreas Schwab
2011-06-28 19:16               ` lee
2011-06-26 19:37     ` Lars Magne Ingebrigtsen
2011-06-27  1:49       ` lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iprp3b5r.fsf@yun.yagibdah.de \
    --to=lee@yun.yagibdah.de \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).