--- /dev/null
+Return-Path: <bremner@tesseract.cs.unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 35DC7431FBD\r
+ for <notmuch@notmuchmail.org>; Mon, 9 Mar 2015 13:53:46 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.438\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
+ tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id xDgkuGY3z0qJ for <notmuch@notmuchmail.org>;\r
+ Mon, 9 Mar 2015 13:53:43 -0700 (PDT)\r
+Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net\r
+ [87.98.215.224])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id E6BFA431FBC\r
+ for <notmuch@notmuchmail.org>; Mon, 9 Mar 2015 13:53:42 -0700 (PDT)\r
+Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim\r
+ 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1YV4eL-00063c-Hs; Mon, 09 Mar 2015 20:51:41 +0000\r
+Received: (nullmailer pid 22313 invoked by uid 1000); Mon, 09 Mar 2015\r
+ 20:51:28 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: Jani Nikula <jani@nikula.org>, David Bremner <david@tethera.net>,\r
+ notmuch@notmuchmail.org\r
+Subject: [Patch v2 1/2] CLI: set up infrastructure to make path to gpg\r
+ configurable.\r
+Date: Mon, 9 Mar 2015 21:51:22 +0100\r
+Message-Id: <1425934283-22269-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <87fv9givdr.fsf@nikula.org>\r
+References: <87fv9givdr.fsf@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 09 Mar 2015 20:53:46 -0000\r
+\r
+GMIME takes a path to gpg, but we hardcode that path. In this commit\r
+we set up argument passing and option storage to allow this path to\r
+specified in the top level notmuch command.\r
+---\r
+ crypto.c | 10 +++++-----\r
+ notmuch-client.h | 1 +\r
+ notmuch-reply.c | 3 ++-\r
+ notmuch-show.c | 3 ++-\r
+ 4 files changed, 10 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/crypto.c b/crypto.c\r
+index 6f4a6db..026640f 100644\r
+--- a/crypto.c\r
++++ b/crypto.c\r
+@@ -24,12 +24,12 @@\r
+ \r
+ /* Create a GPG context (GMime 2.6) */\r
+ static notmuch_crypto_context_t *\r
+-create_gpg_context (void)\r
++create_gpg_context (const char *gpgpath)\r
+ {\r
+ notmuch_crypto_context_t *gpgctx;\r
+ \r
+ /* TODO: GMimePasswordRequestFunc */\r
+- gpgctx = g_mime_gpg_context_new (NULL, "gpg");\r
++ gpgctx = g_mime_gpg_context_new (NULL, gpgpath ? gpgpath : "gpg");\r
+ if (! gpgctx)\r
+ return NULL;\r
+ \r
+@@ -43,13 +43,13 @@ create_gpg_context (void)\r
+ \r
+ /* Create a GPG context (GMime 2.4) */\r
+ static notmuch_crypto_context_t *\r
+-create_gpg_context (void)\r
++create_gpg_context (const char* gpgpath)\r
+ {\r
+ GMimeSession *session;\r
+ notmuch_crypto_context_t *gpgctx;\r
+ \r
+ session = g_object_new (g_mime_session_get_type (), NULL);\r
+- gpgctx = g_mime_gpg_context_new (session, "gpg");\r
++ gpgctx = g_mime_gpg_context_new (session, gpgpath ? gpgpath : "gpg");\r
+ g_object_unref (session);\r
+ \r
+ if (! gpgctx)\r
+@@ -83,7 +83,7 @@ notmuch_crypto_get_context (notmuch_crypto_t *crypto, const char *protocol)\r
+ if (strcasecmp (protocol, "application/pgp-signature") == 0 ||\r
+ strcasecmp (protocol, "application/pgp-encrypted") == 0) {\r
+ if (! crypto->gpgctx) {\r
+- crypto->gpgctx = create_gpg_context ();\r
++ crypto->gpgctx = create_gpg_context (crypto->gpgpath);\r
+ if (! crypto->gpgctx)\r
+ fprintf (stderr, "Failed to construct gpg context.\n");\r
+ }\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index 5e0d475..c25c4ea 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -80,6 +80,7 @@ typedef struct notmuch_crypto {\r
+ notmuch_crypto_context_t* gpgctx;\r
+ notmuch_bool_t verify;\r
+ notmuch_bool_t decrypt;\r
++ const char *gpgpath;\r
+ } notmuch_crypto_t;\r
+ \r
+ typedef struct notmuch_show_params {\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index 7c1c809..e18370f 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -769,7 +769,8 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])\r
+ .part = -1,\r
+ .crypto = {\r
+ .verify = FALSE,\r
+- .decrypt = FALSE\r
++ .decrypt = FALSE,\r
++ .gpgpath = NULL\r
+ }\r
+ };\r
+ int format = FORMAT_DEFAULT;\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index d416fbd..d292f29 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -1082,7 +1082,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])\r
+ .output_body = TRUE,\r
+ .crypto = {\r
+ .verify = FALSE,\r
+- .decrypt = FALSE\r
++ .decrypt = FALSE,\r
++ .gpgpath = NULL\r
+ },\r
+ .include_html = FALSE\r
+ };\r
+-- \r
+2.1.4\r
+\r