--- /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 944F2431FD4\r
+ for <notmuch@notmuchmail.org>; Fri, 13 Apr 2012 18:44:35 -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 yRnBB3olETHY for <notmuch@notmuchmail.org>;\r
+ Fri, 13 Apr 2012 18:44:34 -0700 (PDT)\r
+Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com\r
+ [209.85.160.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id CA2A4431FD2\r
+ for <notmuch@notmuchmail.org>; Fri, 13 Apr 2012 18:44:32 -0700 (PDT)\r
+Received: by mail-pb0-f53.google.com with SMTP id uo1so4830870pbc.26\r
+ for <notmuch@notmuchmail.org>; Fri, 13 Apr 2012 18:44:32 -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:in-reply-to:references;\r
+ bh=BLJnmb8XSHYs/GZP5hQVo7ptuP0f0GdklFmEZWiSCjo=;\r
+ b=saK8nfSzuSZooHkHyRTuiHmkADRx4PLv/xKThiGFZWpAujOL371l5g8uPauvQmqYit\r
+ XjiDkB60720ykx3hbu8li8Su1cg7MgqCTiHtYHWJdQlh8fx6gMzACJqDo7ThhaUIAxhv\r
+ ps/7vRmOWsGjwlU1EZ/uZgAgjQ3QE2ikLpmxINVJwDFWBBLWnV+89g8TZvI5dtQHHC7a\r
+ wO6d1xNVoeEgWTmcxvkNwd1J76ZVfNJxG0xQJQKd0MTggaMA8aP+HO44YSfo6Tm9tO2J\r
+ qv5Gsk5pOTWrWOU/OtekcJ25NlqVBXOyiHPWFPBFuBnPA4JTEMlaaGLzLiMWvDpe7/BM\r
+ IdKg==\r
+Received: by 10.68.134.133 with SMTP id pk5mr9146586pbb.17.1334367872694;\r
+ Fri, 13 Apr 2012 18:44:32 -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 2sm10253360pbw.57.2012.04.13.18.44.28\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Fri, 13 Apr 2012 18:44:31 -0700 (PDT)\r
+From: Peter Wang <novalazy@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 5/6] config: Add 'config list' command\r
+Date: Sat, 14 Apr 2012 11:41:05 +1000\r
+Message-Id: <1334367666-10954-6-git-send-email-novalazy@gmail.com>\r
+X-Mailer: git-send-email 1.7.4.4\r
+In-Reply-To: <1334367666-10954-1-git-send-email-novalazy@gmail.com>\r
+References: <1332282698-7951-1-git-send-email-novalazy@gmail.com>\r
+ <1334367666-10954-1-git-send-email-novalazy@gmail.com>\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: Sat, 14 Apr 2012 01:44:35 -0000\r
+\r
+Add a command to list all configuration items with their associated\r
+values.\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 | 47 +++++++++++++++++++++++++++++++++++++++++++++++\r
+ test/config | 1 -\r
+ 2 files changed, 47 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/notmuch-config.c b/notmuch-config.c\r
+index f9eb977..3e37a2d 100644\r
+--- a/notmuch-config.c\r
++++ b/notmuch-config.c\r
+@@ -799,6 +799,51 @@ 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)\r
++{\r
++ notmuch_config_t *config;\r
++ char **groups;\r
++ size_t g, groups_length;\r
++\r
++ config = notmuch_config_open (ctx, NULL, NULL);\r
++ if (config == NULL)\r
++ return 1;\r
++\r
++ groups = g_key_file_get_groups (config->key_file, &groups_length);\r
++ if (groups == NULL)\r
++ return 1;\r
++\r
++ for (g = 0; g < groups_length; g++) {\r
++ char **keys;\r
++ size_t k, keys_length;\r
++\r
++ keys = g_key_file_get_keys (config->key_file,\r
++ groups[g], &keys_length, NULL);\r
++ if (keys == NULL)\r
++ continue;\r
++\r
++ for (k = 0; k < keys_length; k++) {\r
++ char *value;\r
++\r
++ value = g_key_file_get_string (config->key_file,\r
++ groups[g], keys[k], NULL);\r
++ if (value != NULL) {\r
++ printf ("%s.%s=%s\n", groups[g], keys[k], value);\r
++ free (value);\r
++ }\r
++ }\r
++\r
++ g_strfreev (keys);\r
++ }\r
++\r
++ g_strfreev (groups);\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
+@@ -823,6 +868,8 @@ notmuch_config_command (void *ctx, int argc, char *argv[])\r
+ return 1;\r
+ }\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);\r
+ }\r
+ \r
+ fprintf (stderr, "Unrecognized argument for notmuch config: %s\n",\r
+diff --git a/test/config b/test/config\r
+index 3bf8098..93ecb13 100755\r
+--- a/test/config\r
++++ b/test/config\r
+@@ -43,7 +43,6 @@ notmuch config set foo.nonexistent\r
+ test_expect_equal "$(notmuch config get foo.nonexistent)" ""\r
+ \r
+ test_begin_subtest "List all items"\r
+-test_subtest_known_broken\r
+ notmuch config set database.path "/canonical/path"\r
+ output=$(notmuch config list)\r
+ test_expect_equal "$output" "\\r
+-- \r
+1.7.4.4\r
+\r