--- /dev/null
+Return-Path: <jrollins@finestructure.net>\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 1487D431FBC\r
+ for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 14:15:09 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 boAmWp69TsEK for <notmuch@notmuchmail.org>;\r
+ Sun, 22 Nov 2009 14:15:08 -0800 (PST)\r
+Received: from tarap.cc.columbia.edu (tarap.cc.columbia.edu [128.59.29.7])\r
+ by olra.theworths.org (Postfix) with ESMTP id 1D685431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 14:15:08 -0800 (PST)\r
+Received: from servo.finestructure.net (cpe-72-227-128-66.nyc.res.rr.com\r
+ [72.227.128.66])\r
+ (user=jgr2110 author=jrollins@finestructure.net mech=PLAIN bits=0)\r
+ by tarap.cc.columbia.edu (8.14.3/8.14.3) with ESMTP id nAMMF75B011840\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT)\r
+ for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 17:15:07 -0500 (EST)\r
+Received: from jrollins by servo.finestructure.net with local (Exim 4.69)\r
+ (envelope-from <jrollins@finestructure.net>) id 1NCKiJ-0004jG-5H\r
+ for notmuch@notmuchmail.org; Sun, 22 Nov 2009 17:15:23 -0500\r
+Date: Sun, 22 Nov 2009 17:15:23 -0500\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: notmuch@notmuchmail.org\r
+Message-ID: <20091122221523.GA8703@finestructure.net>\r
+References: <1258927116-528-1-git-send-email-jrollins@finestructure.net>\r
+ <1258927116-528-2-git-send-email-jrollins@finestructure.net>\r
+ <1258927116-528-3-git-send-email-jrollins@finestructure.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; micalg=pgp-sha256;\r
+ protocol="application/pgp-signature"; boundary="uAKRQypu60I7Lcqm"\r
+Content-Disposition: inline\r
+In-Reply-To: <1258927116-528-3-git-send-email-jrollins@finestructure.net>\r
+User-Agent: Mutt/1.5.20 (2009-06-14)\r
+X-No-Spam-Score: Local\r
+X-Scanned-By: MIMEDefang 2.65 on 128.59.29.7\r
+Subject: Re: [notmuch] [PATCH 3/3] change config file location to be\r
+ ~/.notmuch/config\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\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, 22 Nov 2009 22:15:09 -0000\r
+\r
+\r
+--uAKRQypu60I7Lcqm\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+Hi, folks. I wanted to comment on this patch request.\r
+\r
+I personally think it makes a lot of sense to use config directories.\r
+This makes things much neater, since all config files can be kept in\r
+one place without clutter the config name space. I can imagine down\r
+the line that there may be more notmuch config files, and it would be\r
+nicer to have a config directory rather than a bunch of ~/.notmuch-*\r
+files in the user dot file config space.\r
+\r
+I also imagine this config directory as a place to store the notmuch\r
+database files. I would rather keep all the notmuch data and config\r
+files together in one place, and keep my mail directories completely\r
+untouched (only read) by notmuch, if possible.\r
+\r
+I realize, however, there is a transition problem associated with\r
+moving the config file, which is why I propose it be moved sooner\r
+rather than later. If folks are interested in this change, and are\r
+worried about transition even at this early stage, we can try to come\r
+up with some smoother transition code.\r
+\r
+Finally, I am (maybe clearly) *not* particularly adept at c\r
+programming. I'm still learning. I think I already have better ways\r
+to improve this patch. I will try to make some improvements and send\r
+those along as well.\r
+\r
+jamie.\r
+\r
+PS. I'm sure this has already been discussed on the list, but if this\r
+is not the best way to send patches, please let me know. I would be\r
+happy to send a pointer to my notmuch git repo if it would be\r
+preferable to just pull from it directly.\r
+\r
+\r
+On Sun, Nov 22, 2009 at 04:58:36PM -0500, Jameson Graef Rollins wrote:\r
+> This change creates a ~/.notmuch config directory where the config\r
+> file is stored when created with the "setup" command. The use of a\r
+> ~/.notmuch config directory creates one place where all notmuch config\r
+> files and data can be stored, which will greatly simplify managing\r
+> notmuch, and reduce cluter of user dot files.\r
+> ---\r
+> notmuch-config.c | 21 ++++++++++++++++++---\r
+> notmuch-setup.c | 2 +-\r
+> notmuch.1 | 4 ++--\r
+> notmuch.c | 2 +-\r
+> 4 files changed, 22 insertions(+), 7 deletions(-)\r
+>=20\r
+> diff --git a/notmuch-config.c b/notmuch-config.c\r
+> index 7252a19..321c880 100644\r
+> --- a/notmuch-config.c\r
+> +++ b/notmuch-config.c\r
+> @@ -22,9 +22,11 @@\r
+> =20\r
+> #include <pwd.h>\r
+> #include <netdb.h>\r
+> +#include <libgen.h>\r
+> +#include <sys/stat.h>\r
+> =20\r
+> static const char toplevel_config_comment[] =3D\r
+> - " .notmuch-config - Configuration file for the notmuch mail system\n"\r
+> + " .notmuch/config - Configuration file for the notmuch mail system\n"\r
+> "\n"\r
+> " For more information about notmuch, see http://notmuchmail.org";\r
+> =20\r
+> @@ -134,7 +136,7 @@ get_username_from_passwd_file (void *ctx)\r
+> =20\r
+> /* Open the named notmuch configuration file. A filename of NULL will\r
+> * be interpreted as the default configuration file\r
+> - * ($HOME/.notmuch-config).\r
+> + * ($HOME/.notmuch/config).\r
+> *\r
+> * If any error occurs, (out of memory, or a permission-denied error,\r
+> * etc.), this function will print a message to stderr and return\r
+> @@ -183,7 +185,7 @@ notmuch_config_open (void *ctx,\r
+> if (filename)\r
+> config->filename =3D talloc_strdup (config, filename);\r
+> else\r
+> - config->filename =3D talloc_asprintf (config, "%s/.notmuch-config",\r
+> + config->filename =3D talloc_asprintf (config, "%s/.notmuch/config",\r
+> getenv ("HOME"));\r
+> =20\r
+> config->key_file =3D g_key_file_new ();\r
+> @@ -297,14 +299,27 @@ notmuch_config_save (notmuch_config_t *config)\r
+> {\r
+> size_t length;\r
+> char *data;\r
+> + char buf[256];\r
+> GError *error =3D NULL;\r
+> =20\r
+> + struct stat statbuf;\r
+> +\r
+> data =3D g_key_file_to_data (config->key_file, &length, NULL);\r
+> if (data =3D=3D NULL) {\r
+> fprintf (stderr, "Out of memory.\n");\r
+> return 1;\r
+> }\r
+> =20\r
+> + /* Create config directory if it doesn't already exist */\r
+> + snprintf(buf, sizeof buf, "%s", config->filename);\r
+> + dirname(buf);\r
+> + if (stat(buf, &statbuf) < 0) {\r
+> + if (mkdir(buf, 0755) < 0) {\r
+> + fprintf (stderr, "Could not create directory '%s'\n.", buf);\r
+> + return 1;\r
+> + }\r
+> + }\r
+> +\r
+> if (! g_file_set_contents (config->filename, data, length, &error)) {\r
+> fprintf (stderr, "Error saving configuration to %s: %s\n",\r
+> config->filename, error->message);\r
+> diff --git a/notmuch-setup.c b/notmuch-setup.c\r
+> index 68788e1..76e104c 100644\r
+> --- a/notmuch-setup.c\r
+> +++ b/notmuch-setup.c\r
+> @@ -74,7 +74,7 @@ welcome_message_post_setup (void)\r
+> {\r
+> printf ("\n"\r
+> "Notmuch is now configured, and the configuration settings are saved in\=\r
+n"\r
+> -"a file in your home directory named .notmuch-config . If you'd like to\=\r
+n"\r
+> +"a file in your home directory named .notmuch/config . If you'd like to\=\r
+n"\r
+> "change the configuration in the future, you can either edit that file\n"\r
+> "directly or run \"notmuch setup\".\n\n"\r
+> =20\r
+> diff --git a/notmuch.1 b/notmuch.1\r
+> index 8a3fb40..9ea1d42 100644\r
+> --- a/notmuch.1\r
+> +++ b/notmuch.1\r
+> @@ -53,7 +53,7 @@ Interactively sets up notmuch for first use.\r
+> The setup command will prompt for your full name, your primary email\r
+> address, any alternate email addresses you use, and the directory\r
+> containing your email archives. Your answers will be written to a\r
+> -configuration file in ${HOME}/.notmuch-config . This configuration\r
+> +configuration file in ${HOME}/.notmuch/config . This configuration\r
+> file will be created with descriptive comments, making it easy to edit\r
+> by hand later to change the configuration. Or you can run\r
+> .B "notmuch setup"\r
+> @@ -245,7 +245,7 @@ takes an existing set of messages and constructs a su=\r
+itable mail\r
+> template. The Reply-to header (if any, otherwise From:) is used for\r
+> the To: address. Vales from the To: and Cc: headers are copied, but\r
+> not including any of the current user's email addresses (as configured\r
+> -in primary_mail or other_email in the .notmuch-config file) in the\r
+> +in primary_mail or other_email in the .notmuch/config file) in the\r
+> recipient list\r
+> =20\r
+> It also builds a suitable new subject, including Re: at the front (if\r
+> diff --git a/notmuch.c b/notmuch.c\r
+> index 5cc8e4c..2d19a91 100644\r
+> --- a/notmuch.c\r
+> +++ b/notmuch.c\r
+> @@ -98,7 +98,7 @@ command_t commands[] =3D {\r
+> "\t\tThe setup command will prompt for your full name, your primar=\r
+y\n"\r
+> "\t\temail address, any alternate email addresses you use, and the=\r
+\n"\r
+> "\t\tdirectory containing your email archives. Your answers will b=\r
+e\n"\r
+> - "\t\twritten to a configuration file in ${HOME}/.notmuch-config .\=\r
+n"\r
+> + "\t\twritten to a configuration file in ${HOME}/.notmuch/config .\=\r
+n"\r
+> "\n"\r
+> "\t\tThis configuration file will be created with descriptive\n"\r
+> "\t\tcomments, making it easy to edit by hand later to change the\=\r
+n"\r
+> --=20\r
+> 1.6.5\r
+>=20\r
+\r
+--uAKRQypu60I7Lcqm\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+Content-Description: Digital signature\r
+Content-Disposition: attachment\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iQIcBAEBCAAGBQJLCbf4AAoJEO00zqvie6q8gl4QAIUeXQmy6Eu4bc5+rV48Svuy\r
+OodWNGV4huvUQA3TM4DEBift95Pm6gcnULbvr7u7frwNXYcbn4DgFgWuze7QpBhD\r
+apBe7W90Mrkm6rCOU1z4TUbhHQpl1OTc/Yz9dK8HWSdZwB2EG15D1MwdCrVudrNd\r
+LSaZGoZZyhMoCH/ztgvCH9IGaqBCrIUZ6dutaa0IVb23DH0u44A8XqEHbBudQdGV\r
+OwrknJH8SAv2JiHq74goN+AtblLhMUdltoBZTr9bZJ/t50/s9syG2uEi1wTrqcfN\r
+/DAOmKk26WG2gI/IqSlcQSQodVO493OLNwkxNsPB2KuXf28m81kFiL4vVYgRPj6s\r
+5V8mJGLXtfJvrYVUGBpDj0BeYODaXI0NpXZ6PgE3vIYLGF+zI2TDePvEcOpfn8ZF\r
+Gx/OOHWlty/2YReQqmYs4lVKA+JB5f+K7EaGyH2mbg6g/D2D9suWk5wpNbYBrxEp\r
+DpUBxQO5G70TqVwJJxBRDp9gDKjrU1Ug25xu45+LmEYbRlA90x9tQJezcJPTOY/F\r
+VU592vxaosYMfm+xl4YlX6V7d7SZbGhiYq2rGgwqR/5rTLwroq+4nIU1Y0jcyAwp\r
+dHGrJhJSfB9CjmPHrmWswM8SpA3Vzg80EgBFMWjjp87d9FJgPpT9vAfXZb2LZhhW\r
+pVdclc4G7qnZO3BoCgQI\r
+=8STB\r
+-----END PGP SIGNATURE-----\r
+\r
+--uAKRQypu60I7Lcqm--\r