[notmuch] [patch] store folder information

Carl Worth cworth at cworth.org
Tue Dec 15 13:22:19 PST 2009


On Mon, 14 Dec 2009 14:21:50 -0500, Andreas Klöckner <lists at informa.tiker.net> wrote:
> I've patched notmuch to retain information on which folder emails are stored 
> in. This makes the transition from a folders-and-procmail model somewhat 
> easier. The resulting changes are attached.

Very nice. I like this idea very much.

(We recently had discussions about automatically adding tags based on
the directories in which mail files were found, and I said I'd prefer a
solution which allowed the user to search on the directory name
instead.)

> @@ -116,6 +116,8 @@ skip_re_in_subject (const char *subject)
>  	    s++;
>  	if (strncasecmp (s, "re:", 3) == 0)
>  	    s += 3;
> +        else if (strncasecmp (s, "aw:", 3) == 0)
> +	    s += 3;
>  	else
>  	    break;
>      }

This hunk looks unrelated to the rest. Could you submit that separately,
please?

> +    gchar *full_folder_name = NULL;
> +    gchar *folder_base_name = NULL;
> +
> +    /* Find name of "folder" containing the email. */
> +    full_folder_name = g_strdup(path);
> +    while (1)
> +    {
> +        folder_base_name = g_path_get_basename(full_folder_name);

The trailing directory name is available already during the
traversal. So you don't need to search it back out again. See the patch
in the following message:

	id:87fx8bygi7.fsf at linux.vnet.ibm.com

which simply passes the trailing directory name along, (but skipping a
name of "cur" or "new" while traversing).

That kind of approach looks a lot nice to me.

Beyond that, though, I imagine some people have hierarchical folders as
well, so it probably makes sense to store them as well.

To do that, it's probably just a matter of calling gen_terms on the
complete filename. I haven't tested, but doing that should allow
Xapian's phrase searching to do the right thing for something like:

	filename:portion/of/the/path/name

I think something like that is what I would like to see.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091215/ffdc862b/attachment.pgp>


More information about the notmuch mailing list