Re: Batch tagging - add id_list as tag possible?
[notmuch-archives.git] / be / 03631466aa7aa490b7fd6147a4bd7cc999d066
1 Return-Path: <bart@jukie.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 52DE9431FBC\r
6         for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 14:24:56 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id CPPa7KW73EYF for <notmuch@notmuchmail.org>;\r
11         Sun, 22 Nov 2009 14:24:55 -0800 (PST)\r
12 Received: from tau.jukie.net (tau.jukie.net [216.239.93.128])\r
13         by olra.theworths.org (Postfix) with ESMTP id 68C83431FAE\r
14         for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 14:24:54 -0800 (PST)\r
15 Received: by tau.jukie.net (Postfix, from userid 1000)\r
16         id E92D0C035FB; Sun, 22 Nov 2009 17:24:53 -0500 (EST)\r
17 Date: Sun, 22 Nov 2009 17:24:53 -0500\r
18 From: Bart Trojanowski <bart@jukie.net>\r
19 To: Jameson Graef Rollins <jrollins@finestructure.net>\r
20 Message-ID: <20091122222453.GM17268@jukie.net>\r
21 References: <1258927116-528-1-git-send-email-jrollins@finestructure.net>\r
22         <1258927116-528-2-git-send-email-jrollins@finestructure.net>\r
23         <1258927116-528-3-git-send-email-jrollins@finestructure.net>\r
24         <20091122221523.GA8703@finestructure.net>\r
25 MIME-Version: 1.0\r
26 Content-Type: text/plain; charset=us-ascii\r
27 Content-Disposition: inline\r
28 In-Reply-To: <20091122221523.GA8703@finestructure.net>\r
29 User-Agent: Mutt/1.5.18 (2008-05-17)\r
30 Cc: notmuch@notmuchmail.org\r
31 Subject: Re: [notmuch] [PATCH 3/3] change config file location to\r
32         be      ~/.notmuch/config\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.12\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Sun, 22 Nov 2009 22:24:56 -0000\r
46 \r
47 I totally agree with Jamie about the config rename.  I don't know if I\r
48 agree with the database location change... but I might just need some\r
49 convincing.\r
50 \r
51 Would it be enough to just read .notmuch/config and fall back to\r
52 .notmuch-config otherwise?\r
53 \r
54 -Bart\r
55 \r
56 * Jameson Graef Rollins <jrollins@finestructure.net> [091122 17:15]:\r
57 > Hi, folks.  I wanted to comment on this patch request.\r
58\r
59 > I personally think it makes a lot of sense to use config directories.\r
60 > This makes things much neater, since all config files can be kept in\r
61 > one place without clutter the config name space.  I can imagine down\r
62 > the line that there may be more notmuch config files, and it would be\r
63 > nicer to have a config directory rather than a bunch of ~/.notmuch-*\r
64 > files in the user dot file config space.\r
65\r
66 > I also imagine this config directory as a place to store the notmuch\r
67 > database files.  I would rather keep all the notmuch data and config\r
68 > files together in one place, and keep my mail directories completely\r
69 > untouched (only read) by notmuch, if possible.\r
70\r
71 > I realize, however, there is a transition problem associated with\r
72 > moving the config file, which is why I propose it be moved sooner\r
73 > rather than later.  If folks are interested in this change, and are\r
74 > worried about transition even at this early stage, we can try to come\r
75 > up with some smoother transition code.\r
76\r
77 > Finally, I am (maybe clearly) *not* particularly adept at c\r
78 > programming.  I'm still learning.  I think I already have better ways\r
79 > to improve this patch.  I will try to make some improvements and send\r
80 > those along as well.\r
81\r
82 > jamie.\r
83\r
84 > PS. I'm sure this has already been discussed on the list, but if this\r
85 > is not the best way to send patches, please let me know.  I would be\r
86 > happy to send a pointer to my notmuch git repo if it would be\r
87 > preferable to just pull from it directly.\r
88\r
89\r
90 > On Sun, Nov 22, 2009 at 04:58:36PM -0500, Jameson Graef Rollins wrote:\r
91 > > This change creates a ~/.notmuch config directory where the config\r
92 > > file is stored when created with the "setup" command.  The use of a\r
93 > > ~/.notmuch config directory creates one place where all notmuch config\r
94 > > files and data can be stored, which will greatly simplify managing\r
95 > > notmuch, and reduce cluter of user dot files.\r
96 > > ---\r
97 > >  notmuch-config.c |   21 ++++++++++++++++++---\r
98 > >  notmuch-setup.c  |    2 +-\r
99 > >  notmuch.1        |    4 ++--\r
100 > >  notmuch.c        |    2 +-\r
101 > >  4 files changed, 22 insertions(+), 7 deletions(-)\r
102 > > \r
103 > > diff --git a/notmuch-config.c b/notmuch-config.c\r
104 > > index 7252a19..321c880 100644\r
105 > > --- a/notmuch-config.c\r
106 > > +++ b/notmuch-config.c\r
107 > > @@ -22,9 +22,11 @@\r
108 > >  \r
109 > >  #include <pwd.h>\r
110 > >  #include <netdb.h>\r
111 > > +#include <libgen.h>\r
112 > > +#include <sys/stat.h>\r
113 > >  \r
114 > >  static const char toplevel_config_comment[] =\r
115 > > -    " .notmuch-config - Configuration file for the notmuch mail system\n"\r
116 > > +    " .notmuch/config - Configuration file for the notmuch mail system\n"\r
117 > >      "\n"\r
118 > >      " For more information about notmuch, see http://notmuchmail.org";\r
119 > >  \r
120 > > @@ -134,7 +136,7 @@ get_username_from_passwd_file (void *ctx)\r
121 > >  \r
122 > >  /* Open the named notmuch configuration file. A filename of NULL will\r
123 > >   * be interpreted as the default configuration file\r
124 > > - * ($HOME/.notmuch-config).\r
125 > > + * ($HOME/.notmuch/config).\r
126 > >   *\r
127 > >   * If any error occurs, (out of memory, or a permission-denied error,\r
128 > >   * etc.), this function will print a message to stderr and return\r
129 > > @@ -183,7 +185,7 @@ notmuch_config_open (void *ctx,\r
130 > >      if (filename)\r
131 > >     config->filename = talloc_strdup (config, filename);\r
132 > >      else\r
133 > > -   config->filename = talloc_asprintf (config, "%s/.notmuch-config",\r
134 > > +   config->filename = talloc_asprintf (config, "%s/.notmuch/config",\r
135 > >                                         getenv ("HOME"));\r
136 > >  \r
137 > >      config->key_file = g_key_file_new ();\r
138 > > @@ -297,14 +299,27 @@ notmuch_config_save (notmuch_config_t *config)\r
139 > >  {\r
140 > >      size_t length;\r
141 > >      char *data;\r
142 > > +    char buf[256];\r
143 > >      GError *error = NULL;\r
144 > >  \r
145 > > +    struct stat statbuf;\r
146 > > +\r
147 > >      data = g_key_file_to_data (config->key_file, &length, NULL);\r
148 > >      if (data == NULL) {\r
149 > >     fprintf (stderr, "Out of memory.\n");\r
150 > >     return 1;\r
151 > >      }\r
152 > >  \r
153 > > +    /* Create config directory if it doesn't already exist */\r
154 > > +    snprintf(buf, sizeof buf, "%s", config->filename);\r
155 > > +    dirname(buf);\r
156 > > +    if (stat(buf, &statbuf) < 0) {\r
157 > > +      if (mkdir(buf, 0755) < 0) {\r
158 > > +   fprintf (stderr, "Could not create directory '%s'\n.", buf);\r
159 > > +   return 1;\r
160 > > +      }\r
161 > > +    }\r
162 > > +\r
163 > >      if (! g_file_set_contents (config->filename, data, length, &error)) {\r
164 > >     fprintf (stderr, "Error saving configuration to %s: %s\n",\r
165 > >              config->filename, error->message);\r
166 > > diff --git a/notmuch-setup.c b/notmuch-setup.c\r
167 > > index 68788e1..76e104c 100644\r
168 > > --- a/notmuch-setup.c\r
169 > > +++ b/notmuch-setup.c\r
170 > > @@ -74,7 +74,7 @@ welcome_message_post_setup (void)\r
171 > >  {\r
172 > >      printf ("\n"\r
173 > >  "Notmuch is now configured, and the configuration settings are saved in\n"\r
174 > > -"a file in your home directory named .notmuch-config . If you'd like to\n"\r
175 > > +"a file in your home directory named .notmuch/config . If you'd like to\n"\r
176 > >  "change the configuration in the future, you can either edit that file\n"\r
177 > >  "directly or run \"notmuch setup\".\n\n"\r
178 > >  \r
179 > > diff --git a/notmuch.1 b/notmuch.1\r
180 > > index 8a3fb40..9ea1d42 100644\r
181 > > --- a/notmuch.1\r
182 > > +++ b/notmuch.1\r
183 > > @@ -53,7 +53,7 @@ Interactively sets up notmuch for first use.\r
184 > >  The setup command will prompt for your full name, your primary email\r
185 > >  address, any alternate email addresses you use, and the directory\r
186 > >  containing your email archives. Your answers will be written to a\r
187 > > -configuration file in ${HOME}/.notmuch-config . This configuration\r
188 > > +configuration file in ${HOME}/.notmuch/config . This configuration\r
189 > >  file will be created with descriptive comments, making it easy to edit\r
190 > >  by hand later to change the configuration. Or you can run\r
191 > >  .B "notmuch setup"\r
192 > > @@ -245,7 +245,7 @@ takes an existing set of messages and constructs a suitable mail\r
193 > >  template. The Reply-to header (if any, otherwise From:) is used for\r
194 > >  the To: address. Vales from the To: and Cc: headers are copied, but\r
195 > >  not including any of the current user's email addresses (as configured\r
196 > > -in primary_mail or other_email in the .notmuch-config file) in the\r
197 > > +in primary_mail or other_email in the .notmuch/config file) in the\r
198 > >  recipient list\r
199 > >  \r
200 > >  It also builds a suitable new subject, including Re: at the front (if\r
201 > > diff --git a/notmuch.c b/notmuch.c\r
202 > > index 5cc8e4c..2d19a91 100644\r
203 > > --- a/notmuch.c\r
204 > > +++ b/notmuch.c\r
205 > > @@ -98,7 +98,7 @@ command_t commands[] = {\r
206 > >        "\t\tThe setup command will prompt for your full name, your primary\n"\r
207 > >        "\t\temail address, any alternate email addresses you use, and the\n"\r
208 > >        "\t\tdirectory containing your email archives. Your answers will be\n"\r
209 > > -      "\t\twritten to a configuration file in ${HOME}/.notmuch-config .\n"\r
210 > > +      "\t\twritten to a configuration file in ${HOME}/.notmuch/config .\n"\r
211 > >        "\n"\r
212 > >        "\t\tThis configuration file will be created with descriptive\n"\r
213 > >        "\t\tcomments, making it easy to edit by hand later to change the\n"\r
214 > > -- \r
215 > > 1.6.5\r
216 > > \r
217 \r
218 \r
219 \r
220 > _______________________________________________\r
221 > notmuch mailing list\r
222 > notmuch@notmuchmail.org\r
223 > http://notmuchmail.org/mailman/listinfo/notmuch\r
224 \r
225 \r
226 -- \r
227                                 WebSig: http://www.jukie.net/~bart/sig/\r