From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ODWCH3ETrF5fQQAA0tVLHw (envelope-from ) for ; Fri, 01 May 2020 12:17:53 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id EIbyF3sTrF6dagAAbx9fmQ (envelope-from ) for ; Fri, 01 May 2020 12:18:03 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6E8329400AF for ; Fri, 1 May 2020 12:18:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 9B5826DE0F8A; Fri, 1 May 2020 05:17:57 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id f1r-Ie755_5E; Fri, 1 May 2020 05:17:56 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 51FD56DE10AD; Fri, 1 May 2020 05:17:55 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 1BC676DE10AD for ; Fri, 1 May 2020 05:17:54 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i8jf2jRkawBZ for ; Fri, 1 May 2020 05:17:52 -0700 (PDT) Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by arlo.cworth.org (Postfix) with ESMTPS id C2A956DE0F8A for ; Fri, 1 May 2020 05:17:52 -0700 (PDT) Received: by mail-qv1-f44.google.com with SMTP id fb4so4618346qvb.7 for ; Fri, 01 May 2020 05:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x6l58GHWWOP78zH6cTPlfgwH01JULEeTecekAjOsR7U=; b=dM0vy5O78ugaFxd5nHj+Wl2G/HB4eXSwnIc4gEqNvlBXbPOYCw6/lehVASBIoinzGq d+Tt2U39UHQdoRDBW2ZoW1Ku5Al97c29H6nOF3lB2ZKmlC+oXgLN2r6Zcblofc52hz0A M20eop3pJO1q1ij0iLBsSnjrxwHuFCi0l2Kmp2N50BC3pcZyMGSxApB6B1uhoKoJgGQ5 spWyzPNW5Qi7oQicZ7BMlUUXYswBtBE8l7S2Q8g9807aFJNbMXHnw1IbijojXqiaEJ95 kawmnRWDWLsITIkvyQLImd+dtvwvX9rPJDXoOXOscyGTpb/0Pne3Pav+jfTvf9uLkU9I SBgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x6l58GHWWOP78zH6cTPlfgwH01JULEeTecekAjOsR7U=; b=J7bsU187JmIE5/Hr5UcYRa7a4u8yWRHqLRJuWT/P/yDuOj5NlxZuv96mmeofEqSbgQ JvfyN/r51x99yO81g1C6e/5LcPrYv5FMahymLCTjRf4h2vVIo6ePMqURHeyR+Gw2cilm J9UlASJPftj9To7/JIvpaWjrMR/dVtUKuSuI05S9c1ZYOxCbYGFXrfwkUfM2Q+PVSaM6 oQ+W+ippYAULhOSXFO58Ii+Ro2PN3rXp0unQzoRhrT04CXvoJiHuhvXqQ7qFcA7VA8gx 226LWVHR6WS+YDEUl9p+G7TaUprJ8c4M/BmnrCNtY6YQL8OqSe5M+v62074gT7CP6pn2 sk9w== X-Gm-Message-State: AGi0PubFoix5HW1hnd78sEE0lwxi1zrLY9mVixJDbcOYp+lJEtBhzno4 QEvHhRkf78ISyYvifKpJM9h5KWPFt5fZEwhHOEw5rg== X-Google-Smtp-Source: APiQypJ4PHYZOUjL8nOheEb3xiVbxLQq1ML/0d7cYGDKddIy+BAuRWLlpRgujWJEsYDsNVhqp3USHC90z19RwulqgdI= X-Received: by 2002:a05:6214:593:: with SMTP id bx19mr3758469qvb.2.1588335470806; Fri, 01 May 2020 05:17:50 -0700 (PDT) MIME-Version: 1.0 References: <87h7wzj1r4.fsf@tethera.net> In-Reply-To: <87h7wzj1r4.fsf@tethera.net> From: Ciprian Dorin Craciun Date: Fri, 1 May 2020 15:17:14 +0300 Message-ID: Subject: Re: Add support for `thread` field in `notmuch show` To: David Bremner X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: notmuch@notmuchmail.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 X-Spam-Score: 0.09 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=gmail.com header.s=20161025 header.b=dM0vy5O7; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Scan-Result: default: False [0.09 / 13.00]; GENERIC_REPUTATION(0.00)[-0.46796960237863]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:c]; FREEMAIL_FROM(0.00)[gmail.com]; DWL_DNSWL_FAIL(0.00)[50.126.95.6:server fail]; R_DKIM_REJECT(1.00)[gmail.com:s=20161025]; IP_REPUTATION_HAM(0.00)[asn: 27017(-0.18), country: US(-0.00), ip: 50.126.95.6(-0.47)]; DKIM_TRACE(0.00)[gmail.com:-]; RCPT_COUNT_TWO(0.00)[2]; MX_GOOD(-0.50)[cached: notmuchmail.org]; MAILLIST(-0.20)[mailman]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:27017, ipnet:50.126.64.0/18, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[cipriancraciun@gmail.com,notmuch-bounces@notmuchmail.org]; ARC_NA(0.00)[]; URIBL_BLOCKED(0.00)[tethera.net:email,notmuchmail.org:email]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[notmuch@notmuchmail.org]; HAS_LIST_UNSUB(-0.01)[]; DNSWL_BLOCKED(0.00)[50.126.95.6:from]; RCVD_COUNT_SEVEN(0.00)[8]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed),none] X-TUID: Uh2YXpPG5BTE On Fri, May 1, 2020 at 3:09 PM David Bremner wrote: > Ciprian Dorin Craciun writes: > > I know that one can use `thread:{id:MESSAGE_ID}` to achieve the same > > result, however: > > * it is somewhat cumbersome for the integrator; > > Out of curiousity, what is harder about it? In both cases you have to > extra one value from the JSON. It is cumbersome because: * for once, now you need for each email to run a new `notmuch search` instance to get that email's thread id; this is very sub-optimal when you have more than a handful emails; * secondly, it adds more code to the client; To understand my use-case: I currently intend to use `notmuch show --format=json` to search my emails, and based on that to generate a nice HTML page, displaying all found emails. Now I want to include in each email's section a link to only display the thread. In order to do that, I either have to generate (by usin the technique described above) the `thread:...` for each of those emails, which in turn generates one CLI call per email. (And 99% of the time perhaps I don't even click the thread.) (Another option would be to use the `thread:{id:...}` for that link, but I find this quite a hack.) > > * having the thread identifier explicitly, could be used as a key in a > > cache, or other internal lookups; > > > > In fact the only way one can extract the thread identifier via the > > `notmuch` CLI is to use `notmuch search --output=threads -- > > id:MESSAGE_ID` > > Offhand I have no strong objection to someone (who is not me) adding > this. I think it's important to be aware that thread id's are ephemeral, > and subject to change e.g. if the database is re-built from > scratch. I understand that `thread:...` is tied to a particular database, but that shouldn't be an issue, as people don't regenerate often their databases, and the caches are usually short-lived. This weekend I'll try to take a stab at adding this to `notmuch`. Ciprian.