--- /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 arlo.cworth.org (Postfix) with ESMTP id 8284C6DE1B56\r
+ for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 14:34:32 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.619\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.619 tagged_above=-999 required=5 tests=[AWL=0.609, \r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] 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 MwLFeG-cA7Us for <notmuch@notmuchmail.org>;\r
+ Sun, 5 Apr 2015 14:34:30 -0700 (PDT)\r
+Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net\r
+ [87.98.215.224])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 674116DE1B51\r
+ for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 14:34:30 -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 1YerfA-0002Re-0Z; Sun, 05 Apr 2015 21:01:00 +0000\r
+Received: (nullmailer pid 29566 invoked by uid 1000); Sun, 05 Apr 2015\r
+ 21:00:40 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 4/4] cli: add standard option processing to config and setup\r
+Date: Mon, 6 Apr 2015 05:59:34 +0900\r
+Message-Id: <1428267574-28797-5-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1428267574-28797-1-git-send-email-david@tethera.net>\r
+References: <1428267574-28797-1-git-send-email-david@tethera.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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: Sun, 05 Apr 2015 21:34:32 -0000\r
+\r
+In particular this fixes a recently encountered bug where the\r
+"--config" argument to "notmuch setup" is silently ignored, which the\r
+unpleasant consequence of overwriting the users config file.\r
+---\r
+ notmuch-config.c | 12 ++++++++++++\r
+ notmuch-setup.c | 12 ++++++++++++\r
+ 2 files changed, 24 insertions(+)\r
+\r
+diff --git a/notmuch-config.c b/notmuch-config.c\r
+index 2d5c297..054dd3b 100644\r
+--- a/notmuch-config.c\r
++++ b/notmuch-config.c\r
+@@ -872,6 +872,18 @@ int\r
+ notmuch_config_command (notmuch_config_t *config, int argc, char *argv[])\r
+ {\r
+ int ret;\r
++ int opt_index;\r
++\r
++ notmuch_opt_desc_t options[] = {\r
++ { NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 },\r
++ { 0, 0, 0, 0, 0 }\r
++ };\r
++\r
++ opt_index = parse_arguments (argc, argv, options, 1);\r
++ if (opt_index < 0)\r
++ return EXIT_FAILURE;\r
++\r
++ notmuch_process_shared_options (argv[0]);\r
+ \r
+ argc--; argv++; /* skip subcommand argument */\r
+ \r
+diff --git a/notmuch-setup.c b/notmuch-setup.c\r
+index 36a6171..5fc6e25 100644\r
+--- a/notmuch-setup.c\r
++++ b/notmuch-setup.c\r
+@@ -133,6 +133,7 @@ notmuch_setup_command (notmuch_config_t *config,\r
+ size_t new_tags_len;\r
+ const char **search_exclude_tags;\r
+ size_t search_exclude_tags_len;\r
++ int opt_index;\r
+ \r
+ #define prompt(format, ...) \\r
+ do { \\r
+@@ -145,6 +146,17 @@ notmuch_setup_command (notmuch_config_t *config,\r
+ chomp_newline (response); \\r
+ } while (0)\r
+ \r
++ notmuch_opt_desc_t options[] = {\r
++ { NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 },\r
++ { 0, 0, 0, 0, 0 }\r
++ };\r
++\r
++ opt_index = parse_arguments (argc, argv, options, 1);\r
++ if (opt_index < 0)\r
++ return EXIT_FAILURE;\r
++\r
++ notmuch_process_shared_options (argv[0]);\r
++\r
+ if (notmuch_config_is_new (config))\r
+ welcome_message_pre_setup ();\r
+ \r
+-- \r
+2.1.4\r
+\r