unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* funcmail.py: generate notmuch-tags based on headers
@ 2013-03-22 11:56 Michal Vyskocil
  2013-03-22 12:14 ` Patrick Totzke
  2013-03-29 19:43 ` Jameson Graef Rollins
  0 siblings, 2 replies; 4+ messages in thread
From: Michal Vyskocil @ 2013-03-22 11:56 UTC (permalink / raw)
  To: notmuch

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: funcmail.py: generate notmuch-tags based on headers
  2013-03-22 11:56 funcmail.py: generate notmuch-tags based on headers Michal Vyskocil
@ 2013-03-22 12:14 ` Patrick Totzke
  2013-03-22 13:33   ` Michal Vyskocil
  2013-03-29 19:43 ` Jameson Graef Rollins
  1 sibling, 1 reply; 4+ messages in thread
From: Patrick Totzke @ 2013-03-22 12:14 UTC (permalink / raw)
  To: Michal Vyskocil, notmuch

Could this be integrated into "afew" as a custom filter?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: funcmail.py: generate notmuch-tags based on headers
  2013-03-22 12:14 ` Patrick Totzke
@ 2013-03-22 13:33   ` Michal Vyskocil
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Vyskocil @ 2013-03-22 13:33 UTC (permalink / raw)
  To: Patrick Totzke; +Cc: notmuch

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

On Fri, Mar 22, 2013 at 12:14:00PM +0000, Patrick Totzke wrote:
> Could this be integrated into "afew" as a custom filter?

Probably yes, however I have no plans neither knowledge to do that atm.

Regards
Michal Vyskocil

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: funcmail.py: generate notmuch-tags based on headers
  2013-03-22 11:56 funcmail.py: generate notmuch-tags based on headers Michal Vyskocil
  2013-03-22 12:14 ` Patrick Totzke
@ 2013-03-29 19:43 ` Jameson Graef Rollins
  1 sibling, 0 replies; 4+ messages in thread
From: Jameson Graef Rollins @ 2013-03-29 19:43 UTC (permalink / raw)
  To: Michal Vyskocil, notmuch

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

On Fri, Mar 22 2013, Michal Vyskocil <mvyskocil@suse.cz> wrote:
> 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'

Hi, Michal.  You might consider using a format that might be actually
adopted by notmuch down the line.  This is sure to set off a protracted
bike-shedding debate, but let me get the ball rolling.

Imagine down the line we are able to index arbitrary user-specified
headers.  Maybe we could adopt a new search prefix of the form:

  x:<header>:<value>

e.g.

  x:list-id:notmuch.notmuchmail.org

I think this would work with the Xapian term prefixing, but I'll let the
Xapian experts comment.

Bike shed away!

jamie.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-29 19:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-22 11:56 funcmail.py: generate notmuch-tags based on headers Michal Vyskocil
2013-03-22 12:14 ` Patrick Totzke
2013-03-22 13:33   ` Michal Vyskocil
2013-03-29 19:43 ` Jameson Graef Rollins

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).