unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Michal Vyskocil <mvyskocil@suse.cz>
To: notmuch@notmuchmail.org
Subject: funcmail.py: generate notmuch-tags based on headers
Date: Fri, 22 Mar 2013 12:56:23 +0100	[thread overview]
Message-ID: <20130322115623.GA18329@linux-xtv2.site> (raw)

[-- Attachment #1: Type: text/plain, Size: 1076 bytes --]

Hi,

because it seems that notmuch does not index all headers, I've written a
simple, but quite usable tool, which goes through a maildir and generate
an output for notmuch-tag --batch according a simple rules. I've
borrowed the syntax from notmuch-tag --batch format, so it should be
very easy for any notmuch user to configure.

You can query the content of a paricular header
# tags will be applied when string is in header
+notmuch -inbox -- 'notmuch.notmuchmail.org' in 'List-Id'

or in more than one header
+notmuch -inbox -- 'notmuch.notmuchmail.org' in ('List-Id',
'X-Mailinglist')

Or use the procmail-like grep, where a whole email will be searched for
a pattern.

# procmail-like rule, the whole email is searched for a pattern
+notmuch -inbox -- 'List-Id.*notmuch.notmuchmail.org'

Note the matchin rule is a normal Python expression, so everything
Python interpreted can evaluate, should be used. I've ever wanted to
learn about those parts of a Python, so this was a nice opportunity to
learn.

https://gist.github.com/mvyskocil/5220690

Regards
Michal Vyskocil

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2013-03-22 11:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 11:56 Michal Vyskocil [this message]
2013-03-22 12:14 ` funcmail.py: generate notmuch-tags based on headers Patrick Totzke
2013-03-22 13:33   ` Michal Vyskocil
2013-03-29 19:43 ` Jameson Graef Rollins

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

  List information: https://notmuchmail.org/

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

  git send-email \
    --in-reply-to=20130322115623.GA18329@linux-xtv2.site \
    --to=mvyskocil@suse.cz \
    --cc=notmuch@notmuchmail.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.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).