--- /dev/null
+Return-Path: <fatkasuvayu+linux@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 0065D6DE0275\r
+ for <notmuch@notmuchmail.org>; Wed, 24 Feb 2016 09:22:01 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.011\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.011 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.211,\r
+ SPF_PASS=-0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id vMF0BjWyG4fs for <notmuch@notmuchmail.org>;\r
+ Wed, 24 Feb 2016 09:21:56 -0800 (PST)\r
+Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com\r
+ [209.85.220.47])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 9C86B6DE00DF\r
+ for <notmuch@notmuchmail.org>; Wed, 24 Feb 2016 09:21:55 -0800 (PST)\r
+Received: by mail-pa0-f47.google.com with SMTP id yy13so15823421pab.3\r
+ for <notmuch@notmuchmail.org>; Wed, 24 Feb 2016 09:21:55 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=sender:date:from:to:subject:message-id:mail-followup-to:references\r
+ :mime-version:content-type:content-disposition:in-reply-to\r
+ :user-agent; bh=DjYYQoFB9+sH8qJ/vU001WzEPJCKaSqRHaV1wrXguVA=;\r
+ b=SpDkIZTGkbknpcUEaPdDV+58j0Gx2Pkg/dbETiOsylMBVPk8j1Q/sA89x67y0OkqOR\r
+ EVAH6hg1wx9VUVk8KUmU2f2GxpBH9fnSisFZ8fTsV3FCOwbMbHB2zK029kHCBWzILvvF\r
+ YJUmxr5lNYPgSqXx8mvZ0xF4d4Oen6YKV+MdtSvVQXEL3+E6nE7oZL+P3Jj3JrkHGMyo\r
+ 4FX/soK7vKaolY/HPQwk7FZVnJj5SbQR6mGk3dE9k0XH2fjeIbeyJ3C/X5jhe0C1Wprw\r
+ RZSxr964GPAyrosBltxbaXVqTJ913EADmXz5fe1HtS8fZr3HaKcBpnM9mKl01Sv3frYU\r
+ r0MA==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:sender:date:from:to:subject:message-id\r
+ :mail-followup-to:references:mime-version:content-type\r
+ :content-disposition:in-reply-to:user-agent;\r
+ bh=DjYYQoFB9+sH8qJ/vU001WzEPJCKaSqRHaV1wrXguVA=;\r
+ b=H1RKjXBoYjB1VqRl3d/UGslaUen2dCHsV30NVX6VHS1SZkY6HqoXlQ+Sa4/oE7KTw3\r
+ NBXa0n98pBSEOohvG6iBqYLao+tPNezzWdl91U0nwKlgZfjy8qcVIgAB3RxvIygaBLHk\r
+ HwYCbjNqzj2DWdg2nT34MShe3OXP8tHDPl88AXvCK+/NOVPI2WHKnQEboTOdWaDwZzzH\r
+ UhLvcEF/VWJiVsRVg8wq5SLCUU75FZjya4Dq3e9B8i9SMeTGF5Uw45UX+euo0WXSks4m\r
+ 4Dsju7LeaBSl3us+nP99a41Q4cslO8bR96PyP6zR/6InXzlwxEXXmmtj2eE2hB2lvuaB\r
+ zwoQ==\r
+X-Gm-Message-State:\r
+ AG10YOTQFxhgsznXIXL1lpTWN1Tf6Q4qN5mU793XboQ5TjAuWy3JjlrKF+IrGnpVJct3dg==\r
+X-Received: by 10.67.6.10 with SMTP id cq10mr56341123pad.120.1456334514146;\r
+ Wed, 24 Feb 2016 09:21:54 -0800 (PST)\r
+Received: from chitra.no-ip.org ([111.91.230.10])\r
+ by smtp.gmail.com with ESMTPSA id g10sm6374584pfd.92.2016.02.24.09.21.51\r
+ for <notmuch@notmuchmail.org>\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Wed, 24 Feb 2016 09:21:52 -0800 (PST)\r
+Sender: Suvayu Ali <fatkasuvayu@gmail.com>\r
+Date: Wed, 24 Feb 2016 22:51:45 +0530\r
+From: Suvayu Ali <fatkasuvayu+linux@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: Re: Loading a notmuch email buffer in Emacs from the command line\r
+Message-ID: <20160224172145.GD32295@chitra.no-ip.org>\r
+Mail-Followup-To: notmuch@notmuchmail.org\r
+References: <87egc8nhdh.fsf@nawaz.org>\r
+ <m2si0n660u.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/mixed; boundary="AqsLC8rIMeq19msA"\r
+Content-Disposition: inline\r
+In-Reply-To: <m2si0n660u.fsf@guru.guru-group.fi>\r
+User-Agent: Mutt/1.5.23.1 (2014-03-12)\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 24 Feb 2016 17:22:01 -0000\r
+\r
+\r
+--AqsLC8rIMeq19msA\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+\r
+On Sat, Feb 20, 2016 at 12:16:33PM +0200, Tomi Ollila wrote:\r
+> On Sat, Feb 20 2016, Neeum Zawan <mailinglists@nawaz.org> wrote:\r
+> >\r
+> > Is there a way (e.g. with emacsclient) to load up a particular email\r
+> > thread or email message buffer from the command line?\r
+> \r
+> quick test yields that at least\r
+> \r
+> emacs -f notmuch --eval '(notmuch-search "id:87egc8nhdh.fsf@nawaz.org")'\r
+> \r
+> works (maybe not exactly as desired, but based on that more should\r
+> be able to be achieved with moderate ease...)\r
+\r
+I use the attached script to open the mail I'm reading in Mutt in Emacs\r
+so that I can link to it in my Org mode notes, etc. You could write a\r
+function that calls the required capture templates and use it in place\r
+of the call to notmuch-show. Probably you also want to remove the GNU\r
+Screen related stuff (call to screen select and the check for $STY).\r
+\r
+Hope this helps,\r
+\r
+-- \r
+Suvayu\r
+\r
+Open source is the future. It sets us free.\r
+\r
+--AqsLC8rIMeq19msA\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: attachment; filename=notmuch-emacs\r
+\r
+#!/bin/bash\r
+\r
+# set -o xtrace\r
+\r
+# FIXME: handle cases when not invoked from within screen\r
+declare -a emacsen=(/tmp/emacs$UID/*) screens=(/var/run/screen/S-$USER/*)\r
+# NOTE: look at screen -Q for querying\r
+\r
+# FIXME: cleaner way of switching to threads (something like mutt-search)\r
+declare thread=$1\r
+\r
+[[ -n $STY ]] && { \\r
+ screen -X select nwc; # emacsclient window name for me\r
+\r
+ # NB: reading from PIPE; and it's ok to remove all <, >, or\r
+ # spaces, they are not allowed in a Message-ID\r
+ msgid=$(formail -c -x Message-ID | sed -e 's/[<> ]//g')\r
+ if [[ -n $thread ]]; then\r
+ query=$(notmuch search --output=threads -- "id:$msgid")\r
+ emacsclient --eval "(notmuch-tree \"$query\")"\r
+ else\r
+ query="id:$msgid"\r
+ emacsclient --eval "(notmuch-show \"$query\")"\r
+ fi\r
+}\r
+\r
+--AqsLC8rIMeq19msA--\r