unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Peter John Hartman <peterjohnhartman@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] Have --format=mbox insert Status:
Date: Wed, 2 Feb 2011 18:47:19 -0500	[thread overview]
Message-ID: <20110202234719.GA28241@triltoucheee.wireless.utoronto.ca> (raw)

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

             reply	other threads:[~2011-02-02 23:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 23:47 Peter John Hartman [this message]
2011-02-05 23:08 ` [PATCH] Have --format=mbox insert Status: 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

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=20110202234719.GA28241@triltoucheee.wireless.utoronto.ca \
    --to=peterjohnhartman@gmail.com \
    --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).