--- /dev/null
+Return-Path: <novalazy@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 olra.theworths.org (Postfix) with ESMTP id 084C5431FC0\r
+ for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 15:34:22 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 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] 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 vNUzpR7aR9AA for <notmuch@notmuchmail.org>;\r
+ Tue, 20 Mar 2012 15:34:21 -0700 (PDT)\r
+Received: from mail-pz0-f53.google.com (mail-pz0-f53.google.com\r
+ [209.85.210.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 81C49431FAE\r
+ for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 15:34:21 -0700 (PDT)\r
+Received: by dady25 with SMTP id y25so706824dad.26\r
+ for <notmuch@notmuchmail.org>; Tue, 20 Mar 2012 15:34:20 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer;\r
+ bh=ocv2j0ru7M3tdr3oaEIqKsmR2AMoEGP9+z2on4B6kHo=;\r
+ b=FgM6c3lCHNApHFm0L8oXUf803cirwUIn6J3kJHnmMuJgaL4ZuxD75qlR4vb3su08SW\r
+ +u6TK5VCXkWh3bBBVwcm3aIhoo8IhTCkfJ1LB2lskz+miRN0GuEma54Hm5GjVW6zEa49\r
+ oc5JRi7z0MiY53hUDTBc0qd5R9hv/Ki3O6bZ1MBR4yOlZbTeaS4MM+BVLMQHScnTkZ8K\r
+ ZEgk5LsKnCIuTEelDLlp+wA+yjjb2TkdwhUS2LMzNhvnwsuM1eajj4z0Bu9Q/fN1Y36v\r
+ 3o+w0cX7CllhdmlQg9vFdWfyp+9GACLZdqe/J1MB13EC6HfOk0jteDEwE6Q1vRrJLDeG\r
+ lCoA==\r
+Received: by 10.68.233.168 with SMTP id tx8mr5134911pbc.72.1332282860328;\r
+ Tue, 20 Mar 2012 15:34:20 -0700 (PDT)\r
+Received: from localhost (215.42.233.220.static.exetel.com.au.\r
+ [220.233.42.215])\r
+ by mx.google.com with ESMTPS id f5sm2180693pbe.26.2012.03.20.15.34.17\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Tue, 20 Mar 2012 15:34:19 -0700 (PDT)\r
+From: Peter Wang <novalazy@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] config: Add 'config list' command\r
+Date: Wed, 21 Mar 2012 09:31:37 +1100\r
+Message-Id: <1332282698-7951-1-git-send-email-novalazy@gmail.com>\r
+X-Mailer: git-send-email 1.7.4.4\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, 20 Mar 2012 22:34:22 -0000\r
+\r
+Add a command to list all keys in a given configuration section.\r
+\r
+One use is as follows: a MUA may prefer to store data in a central\r
+notmuch configuration file so that the data is accessible across\r
+different machines, e.g. an addressbook. The list command helps\r
+to implement features such as tab completion on the keys.\r
+---\r
+ notmuch-config.c | 27 +++++++++++++++++++++++++++\r
+ 1 files changed, 27 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/notmuch-config.c b/notmuch-config.c\r
+index e9b2750..595cf54 100644\r
+--- a/notmuch-config.c\r
++++ b/notmuch-config.c\r
+@@ -799,6 +799,31 @@ notmuch_config_command_set (void *ctx, char *item, int argc, char *argv[])\r
+ return ret;\r
+ }\r
+ \r
++static int\r
++notmuch_config_command_list (void *ctx, char *group)\r
++{\r
++ notmuch_config_t *config;\r
++ char **keys;\r
++ size_t i, length;\r
++\r
++ config = notmuch_config_open (ctx, NULL, NULL);\r
++ if (config == NULL)\r
++ return 1;\r
++\r
++ keys = g_key_file_get_keys (config->key_file,\r
++ group, &length, NULL);\r
++ if (keys != NULL) {\r
++ for (i = 0; i < length; i++)\r
++ printf ("%s\n", keys[i]);\r
++\r
++ free (keys);\r
++ }\r
++\r
++ notmuch_config_close (config);\r
++\r
++ return 0;\r
++}\r
++\r
+ int\r
+ notmuch_config_command (void *ctx, int argc, char *argv[])\r
+ {\r
+@@ -813,6 +838,8 @@ notmuch_config_command (void *ctx, int argc, char *argv[])\r
+ return notmuch_config_command_get (ctx, argv[1]);\r
+ else if (strcmp (argv[0], "set") == 0)\r
+ return notmuch_config_command_set (ctx, argv[1], argc - 2, argv + 2);\r
++ else if (strcmp (argv[0], "list") == 0)\r
++ return notmuch_config_command_list (ctx, argv[1]);\r
+ \r
+ fprintf (stderr, "Unrecognized argument for notmuch config: %s\n",\r
+ argv[0]);\r
+-- \r
+1.7.4.4\r
+\r