--- /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 20AF0431FD8\r
+ for <notmuch@notmuchmail.org>; Tue, 9 Dec 2014 12:01:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 lwLR+m5I1t2K for <notmuch@notmuchmail.org>;\r
+ Tue, 9 Dec 2014 12:01:24 -0800 (PST)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\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 4D0D1431FCB\r
+ for <notmuch@notmuchmail.org>; Tue, 9 Dec 2014 12:01:24 -0800 (PST)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1XyQyI-0003HC-5n; Tue, 09 Dec 2014 16:01:22 -0400\r
+Received: (nullmailer pid 23746 invoked by uid 1000); Tue, 09 Dec 2014\r
+ 20:01:16 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] CLI: set up infrastructure to make path to gpg\r
+ configurable.\r
+Date: Tue, 9 Dec 2014 21:01:10 +0100\r
+Message-Id: <1418155271-23704-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.3\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: Tue, 09 Dec 2014 20:01:28 -0000\r
+\r
+GMIME takes a path to gpg, but we hardcode that path. In this commit\r
+we push hardcoding all the way up to the top level of a notmuch\r
+command, where we can later make it configurable.\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.3\r
+\r