Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 89D856DE0948 for ; Sun, 14 Jun 2015 01:23:05 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.719 X-Spam-Level: X-Spam-Status: No, score=-0.719 tagged_above=-999 required=5 tests=[AWL=0.101, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled 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 FXr0_ULYeyxE for ; Sun, 14 Jun 2015 01:23:02 -0700 (PDT) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by arlo.cworth.org (Postfix) with ESMTPS id 7C5EA6DE0350 for ; Sun, 14 Jun 2015 01:23:02 -0700 (PDT) Received: by wiwd19 with SMTP id d19so49862995wiw.0 for ; Sun, 14 Jun 2015 01:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=6B7Nso2ovim6IS0lINlo+NjPFjMJKDAjZArAkwnMCj8=; b=cUGiGZKCeXgEdV80zH9YbQ5+87Ani8QcIwnMv2KJ34lTQuyAkvGQgH07ZZDqeAppb8 jxcvO7FLMYi4tKQOOSAUpM+z/ftKGa+Duyfuptt87znPW8jCK4QJ61lVbVWzw3UcOIOD ArI6ONbdJ4iWqu+XwHWbcNCo/bAT+m7czMIEBg7kaktyn0E1qvImmRlH+joXMBH0eWrZ 0QxEtEIBKU9i82QP+9dUFt607jq2Lx2L2X6yFESZz7bUoVXOLoENc21TL1z8+whOd6Q1 MNfTIRPM1qflsgq3Bjv7wVD3Rzx5qpVp9qsVDOexvrZpKjCIv55gIZiJGdrksulZgNgt nRLw== X-Received: by 10.180.75.8 with SMTP id y8mr21493125wiv.31.1434270181013; Sun, 14 Jun 2015 01:23:01 -0700 (PDT) Received: from chitra.no-ip.org (ip82-139-115-46.lijbrandt.net. [82.139.115.46]) by mx.google.com with ESMTPSA id ul1sm13539890wjc.30.2015.06.14.01.22.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jun 2015 01:23:00 -0700 (PDT) Sender: Suvayu Ali Date: Sun, 14 Jun 2015 10:22:58 +0200 From: Suvayu Ali To: notmuch@notmuchmail.org Subject: Re: search query "replytoid:" Message-ID: <20150614082258.GD17381@chitra.no-ip.org> Mail-Followup-To: notmuch@notmuchmail.org References: <20150613205552.GC17381@chitra.no-ip.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline In-Reply-To: <20150613205552.GC17381@chitra.no-ip.org> User-Agent: Mutt/1.5.23.1 (2014-03-12) X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 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: Sun, 14 Jun 2015 08:23:05 -0000 --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Jun 13, 2015 at 10:55:52PM +0200, Suvayu Ali wrote: > On Sat, Jun 13, 2015 at 02:47:00PM -0400, Xu Wang wrote: > > > > Is it possible to search based on which message ID a message > > *responds* to? For example, suppose message id is MESSAGEID. I want to > > find all emails that responded to MESSAGEID. How to enter such a query > > into notmuch? > > AFAIK, this is not possible. Notmuch does not allow searching special > headers. You could probably write a script using the threads output > format to get the thread, and then use formail to find the responses. Try the attached script. It accepts notmuch queries by message id. E.g. to get the responses to your OP, you can do: $ ./nm-ack id:CAJhTkNhYew6H-bptACTew3gN3DLWg6agTYu8hAkdwFS=z4VFWg@mail.gmail.com id:877fr79upd.fsf@maritornes.cs.unb.ca id:20150613205552.GC17381@chitra.no-ip.org The first one is David's response, the second one is mine. Hope this helps, -- Suvayu Open source is the future. It sets us free. --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=nm-ack #!/bin/bash # Return responses to message id query # # $ nm-ack id:msgid@domain # id:response1@domain1 id:response2@domain2 ... # # Author: Suvayu Ali # debug # set -o xtrace declare query="$1" thread=$(notmuch search --output=threads -- "$1") declare -a msgs=$(notmuch search --output=messages -- "$thread") responses function strip_mid() { sed -e 's/[<> ]//g' } for m in ${msgs[@]}; do [[ $query == $m ]] && continue r=id:$(notmuch show --format=raw -- $m | formail -x In-Reply-To: | strip_mid) [[ $query == $r ]] && responses+=($m) done echo ${responses[@]} --FCuugMFkClbJLl1L--