Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1D555431FD0 for ; Fri, 15 Jul 2011 14:05:08 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ruqfLiZG8Lm4 for ; Fri, 15 Jul 2011 14:05:06 -0700 (PDT) Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 70FCE431FB6 for ; Fri, 15 Jul 2011 14:05:06 -0700 (PDT) Received: by wyh22 with SMTP id 22so157315wyh.26 for ; Fri, 15 Jul 2011 14:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=V3zQRKMzswT0p+Ea5SeFDOsVATl5ziCMX2QVRUMryk4=; b=agiWonabGt/EMh1mOCyXJEr1ofmgKLL0dPjiK2bOmAzdBEEJ8Bb8Z1rFqZVPDDYaY3 A5KY2n140R8IYLY6VPJFYJ9zG0W3laP8cV6+CLrtcf2tsDDmXx9IcYFikKaw+peEJPOc yujFkHKejxzf8UsMbCBed//27LV6fgV4Y9QJg= Received: by 10.227.62.194 with SMTP id y2mr1407413wbh.43.1310763905043; Fri, 15 Jul 2011 14:05:05 -0700 (PDT) Received: from brick.lan (cpc1-sgyl2-0-0-cust47.sgyl.cable.virginmedia.com [80.192.18.48]) by mx.google.com with ESMTPS id ff6sm1355826wbb.32.2011.07.15.14.05.02 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jul 2011 14:05:03 -0700 (PDT) Date: Fri, 15 Jul 2011 22:04:59 +0100 From: Patrick Totzke To: Jameson Graef Rollins Subject: Re: date_relative in notmuch-search Message-ID: <20110715210459.GA12727@brick.lan> References: <20110714222258.GA11914@brick.lan> <87oc0v4jt6.fsf@servo.factory.finestructure.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1LKvkjL3sHcu1TtY" Content-Disposition: inline In-Reply-To: <87oc0v4jt6.fsf@servo.factory.finestructure.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Patrick Totzke , notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2011 21:05:08 -0000 --1LKvkjL3sHcu1TtY Content-Type: multipart/mixed; boundary="gKMricLos+KVdGMg" Content-Disposition: inline --gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Jason, Thanks for the tip with git send-mail. I didn't really intend to get this "patch" accepted. It was more that I feel bad asking for=20 features all the time and as I'm not so comfortable with hacking on the notmuch code I thought I'd ask if one could implement it like this. Anyhow, attached you'll find a patch for the test and another for the proposed change. Feel free to discard it :) Best, /p On Fri, Jul 15, 2011 at 08:58:45AM -0700, Jameson Graef Rollins wrote: > On Thu, 14 Jul 2011 23:22:58 +0100, Patrick Totzke wrote: > > I wodered why "notmuch search --format=3Djson" doesn't provide the "dat= e_relative" field for > > results, as the show command does. > >=20 > > I'm not expert on notmuch internals but I got it working like this: >=20 > Hi, Patrick. I think this is a very reasonable patch. However, there > are a couple of things you need to do to get this patch accepted. >=20 > First of all, you should send the patch to the list in a format that > will allow it to be applied directly to a git repo. In particular, it > needs to include a good commit log message. Look at using git send-mail > to send it to the list, which will format it correctly. >=20 > Also, I'm quite sure this patch will require a couple of changes to the > test suite. You should submit a patch that changes the test suite to > reflect the desired changes *first*, followed by the patch that fixes > the issue. >=20 > Thanks! >=20 > jamie. --gKMricLos+KVdGMg Content-Type: text/x-diff; charset=iso-8859-1 Content-Disposition: attachment; filename="0001-test-date_relative-in-notmuch-search-json-output.patch" Content-Transfer-Encoding: quoted-printable =46rom 9a0260e36e36af94bed695e713bbc1be0a069fce Mon Sep 17 00:00:00 2001 =46rom: pazz Date: Fri, 15 Jul 2011 21:36:54 +0100 Subject: [PATCH 1/2] test: date_relative in notmuch search json output expect the date_relative field for thread entries in notmuch search's json output --- test/json | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/test/json b/test/json index 5a2544c..d54bf25 100755 --- a/test/json +++ b/test/json @@ -12,6 +12,7 @@ add_message "[subject]=3D\"json-search-subject\"" "[date]= =3D\"Sat, 01 Jan 2000 12:00 output=3D$(notmuch search --format=3Djson "json-search-message" | notmuch_= search_sanitize) test_expect_equal "$output" "[{\"thread\": \"XXX\", \"timestamp\": 946728000, +\"date_relative\": \"2000-01-01\", \"matched\": 1, \"total\": 1, \"authors\": \"Notmuch Test Suite\", @@ -28,6 +29,7 @@ add_message "[subject]=3D\"json-search-utf8-body-s=FCbj= =E9ct\"" "[date]=3D\"Sat, 01 Ja output=3D$(notmuch search --format=3Djson "js=F6n-search-m=E9ssage" | notm= uch_search_sanitize) test_expect_equal "$output" "[{\"thread\": \"XXX\", \"timestamp\": 946728000, +\"date_relative\": \"2000-01-01\", \"matched\": 1, \"total\": 1, \"authors\": \"Notmuch Test Suite\", --=20 1.7.4.1 --gKMricLos+KVdGMg Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-json-date_relative-for-threads.patch" Content-Transfer-Encoding: quoted-printable =46rom 1a796b09eb4c6171ddaf5f847df56d1a0181cb7c Mon Sep 17 00:00:00 2001 =46rom: pazz Date: Fri, 15 Jul 2011 21:41:02 +0100 Subject: [PATCH 2/2] json: date_relative for threads include the date_relative field in the json formated output of notmuch search --- notmuch-search.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) 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, =20 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), matched, total, json_quote_str (ctx_quote, authors), --=20 1.7.4.1 --gKMricLos+KVdGMg-- --1LKvkjL3sHcu1TtY Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk4gq3sACgkQlDQDZ9fWxapKwQCffylNXfjJ5/wP3TxSBl9o6jrn VzQAnA7dgbMDYk5wf0MQPb+dM+XPDw3s =htto -----END PGP SIGNATURE----- --1LKvkjL3sHcu1TtY--