unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Have --format=mbox insert Status:
@ 2011-02-02 23:47 Peter John Hartman
  2011-02-05 23:08 ` Michal Sojka
  0 siblings, 1 reply; 5+ messages in thread
From: Peter John Hartman @ 2011-02-02 23:47 UTC (permalink / raw)
  To: notmuch

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

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

end of thread, other threads:[~2011-02-07 14:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-02 23:47 [PATCH] Have --format=mbox insert Status: Peter John Hartman
2011-02-05 23:08 ` Michal Sojka
2011-02-06 20:26   ` Peter John Hartman
2011-02-07  9:04     ` Michal Sojka
2011-02-07 14:22       ` Peter John Hartman

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