unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* date_relative in notmuch-search
@ 2011-07-14 22:22 Patrick Totzke
  2011-07-15 15:58 ` Jameson Graef Rollins
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick Totzke @ 2011-07-14 22:22 UTC (permalink / raw)
  To: notmuch

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

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

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

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

end of thread, other threads:[~2011-12-08  1:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-14 22:22 date_relative in notmuch-search Patrick Totzke
2011-07-15 15:58 ` Jameson Graef Rollins
2011-07-15 21:04   ` Patrick Totzke
2011-07-18 19:07     ` Jameson Graef Rollins
2011-07-23  9:54     ` [PATCH 1/2] test: date_relative in notmuch search json output pazz
2011-07-23  9:54       ` [PATCH 2/2] json: date_relative for threads pazz
2011-12-08  1:29       ` [PATCH 1/2] test: date_relative in notmuch search json output David Bremner

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