date_relative in notmuch-search
Hi, I wodered why "notmuch search --format=json" doesn't provide the "date_relative" field for results, as the show command does. I'm not expert on notmuch internals but I got it working like this: diff --git a/notmuch-search.c b/notmuch-search.c index faccaf7..b1adc03 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -176,12 +176,14 @@ format_thread_json (const void *ctx, printf ("\"thread\": %s,\n" "\"timestamp\": %ld,\n" + "\"date_relative\": \"%s\",\n" "\"matched\": %d,\n" "\"total\": %d,\n" "\"authors\": %s,\n" "\"subject\": %s,\n", json_quote_str (ctx_quote, thread_id), date, + notmuch_time_relative_date (ctx, date), I'm unsure it it's better to use json_quote_str here but you tell me :) Best, /p -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110714/affd94b3/attachment.pgp>
[PATCH] test: Adding non-maildir tags does not move message from new to cur
On 14/07/11 2:06 +0200, Michal Sojka wrote: > From: Michal Sojka > > This adds a test for patch submitted by Louis Rilling. Without his patch > applied this test fails. Thanks a lot Michal! I was indeed wondering how to do this. This test perfectly matches the intended usage. Louis > --- > test/maildir-sync |6 ++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/test/maildir-sync b/test/maildir-sync > index a60854f..e1ad81c 100755 > --- a/test/maildir-sync > +++ b/test/maildir-sync > @@ -88,6 +88,12 @@ test_expect_equal "$output" "No new mail." > # creating new directories in the mail store, then it should be > # creating all necessary database state for those directories. > > +test_begin_subtest "Adding non-maildir tags does not move message from new > to cur" > +add_message [subject]='"Message to stay in new"' [date]='"Sat, 01 Jan 2000 > 12:00:00 -"' [filename]='message-to-stay-in-new' [dir]=new > +notmuch tag +donotmove subject:"Message to stay in new" > +output=$(cd "$MAIL_DIR"; ls */message-to-stay-in-new*) > +test_expect_equal "$output" "new/message-to-stay-in-new" > + > test_begin_subtest "Removing 'S' flag from existing filename adds 'unread' > tag" > add_message [subject]='"Removing S flag"' [filename]='removing-s-flag:2,S' > [dir]=cur > output=$(notmuch search subject:"Removing S flag" | notmuch_search_sanitize) > -- > 1.7.5.4 > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
date_relative in notmuch-search
Hi, I wodered why "notmuch search --format=json" doesn't provide the "date_relative" field for results, as the show command does. I'm not expert on notmuch internals but I got it working like this: diff --git a/notmuch-search.c b/notmuch-search.c index faccaf7..b1adc03 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -176,12 +176,14 @@ format_thread_json (const void *ctx, printf ("\"thread\": %s,\n" "\"timestamp\": %ld,\n" + "\"date_relative\": \"%s\",\n" "\"matched\": %d,\n" "\"total\": %d,\n" "\"authors\": %s,\n" "\"subject\": %s,\n", json_quote_str (ctx_quote, thread_id), date, + notmuch_time_relative_date (ctx, date), I'm unsure it it's better to use json_quote_str here but you tell me :) Best, /p signature.asc Description: Digital signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] test: Adding non-maildir tags does not move message from new to cur
On 14/07/11 2:06 +0200, Michal Sojka wrote: > From: Michal Sojka > > This adds a test for patch submitted by Louis Rilling. Without his patch > applied this test fails. Thanks a lot Michal! I was indeed wondering how to do this. This test perfectly matches the intended usage. Louis > --- > test/maildir-sync |6 ++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/test/maildir-sync b/test/maildir-sync > index a60854f..e1ad81c 100755 > --- a/test/maildir-sync > +++ b/test/maildir-sync > @@ -88,6 +88,12 @@ test_expect_equal "$output" "No new mail." > # creating new directories in the mail store, then it should be > # creating all necessary database state for those directories. > > +test_begin_subtest "Adding non-maildir tags does not move message from new > to cur" > +add_message [subject]='"Message to stay in new"' [date]='"Sat, 01 Jan 2000 > 12:00:00 -"' [filename]='message-to-stay-in-new' [dir]=new > +notmuch tag +donotmove subject:"Message to stay in new" > +output=$(cd "$MAIL_DIR"; ls */message-to-stay-in-new*) > +test_expect_equal "$output" "new/message-to-stay-in-new" > + > test_begin_subtest "Removing 'S' flag from existing filename adds 'unread' > tag" > add_message [subject]='"Removing S flag"' [filename]='removing-s-flag:2,S' > [dir]=cur > output=$(notmuch search subject:"Removing S flag" | notmuch_search_sanitize) > -- > 1.7.5.4 > > ___ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] test: Adding non-maildir tags does not move message from new to cur
From: Michal Sojka This adds a test for patch submitted by Louis Rilling. Without his patch applied this test fails. --- test/maildir-sync |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/test/maildir-sync b/test/maildir-sync index a60854f..e1ad81c 100755 --- a/test/maildir-sync +++ b/test/maildir-sync @@ -88,6 +88,12 @@ test_expect_equal "$output" "No new mail." # creating new directories in the mail store, then it should be # creating all necessary database state for those directories. +test_begin_subtest "Adding non-maildir tags does not move message from new to cur" +add_message [subject]='"Message to stay in new"' [date]='"Sat, 01 Jan 2000 12:00:00 -"' [filename]='message-to-stay-in-new' [dir]=new +notmuch tag +donotmove subject:"Message to stay in new" +output=$(cd "$MAIL_DIR"; ls */message-to-stay-in-new*) +test_expect_equal "$output" "new/message-to-stay-in-new" + test_begin_subtest "Removing 'S' flag from existing filename adds 'unread' tag" add_message [subject]='"Removing S flag"' [filename]='removing-s-flag:2,S' [dir]=cur output=$(notmuch search subject:"Removing S flag" | notmuch_search_sanitize) -- 1.7.5.4