[PATCH] Have --format=mbox insert Status:

Peter John Hartman peterjohnhartman at gmail.com
Wed Feb 2 15:47:19 PST 2011


Hi folks,

This is not a complete patch, but should give you an idea.  (It works well
enough for me, but I think it could do more).

diff --git a/notmuch-show.c b/notmuch-show.c
index ef421ec..dff66de 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -272,6 +272,12 @@ format_message_mbox (const void *ctx,
 
     printf ("From %s %s", from, date_asctime);
 
+    if (strstr(_get_tags_as_string(ctx,message),"unread") != NULL) {
+      printf ("Status: O\n");
+    } else {
+      printf ("Status: RO\n");
+    }
+      
     while ((line_len = getline (&line, &line_size, file)) != -1 ) {
 	if (_is_from_line (line))
 	    putchar ('>');

It could, for instance, insert X-Status: AFTD flags, maybe, and it could be
a little more sensitive about O.  Maybe if tag is "new" it won't put the O
there, but I wasn't sure.  

Anyway, this is chiefly useful for me and others who use the mbox format. 
For instance, I combine notmuch with mutt as follows:

notmuch show --format=mbox $(notmuch search thread:xxx | cut -d' ' -f1) >
tmp.mbox && mutt -f tmp.mbox && rm -f tmp.mbox

Best,
Peter


-- 
sic dicit magister P
PhD Candidate
Collaborative Programme in Ancient and Medieval Philosophy
University of Toronto
http://individual.utoronto.ca/peterjh


More information about the notmuch mailing list