[PATCH 0/5] lib: make folder: prefix literal

Jani Nikula jani at nikula.org
Sat Jan 25 10:22:16 PST 2014


On Sat, 25 Jan 2014, David Bremner <david at tethera.net> wrote:
> Jani Nikula <jani at nikula.org> writes:
>
>> On Sat, 25 Jan 2014, Jani Nikula <jani at nikula.org> wrote:
>>> Perhaps we need to have two prefixes, one of which is the literal
>>> filesystem folder and another which hides the implementation details,
>>> like I mentioned in my mail to Peter [1]. But consider this: my proposed
>>> implementation does cover *all* use cases.
>>
>> Here's a thought. With boolean prefix folder:, we can devise a scheme
>> where the folder: query defines what is to be matched.
>>
>> For example:
>>
>> folder:foo	match files in foo, foo/new, and foo/cur.
>> folder:foo/	match all files in all subdirectories under foo (this
>> 		would handle Tomi's use case), including foo/new and
>>               foo/cur.
>
> handling hierarchies sounds useful and natural
>
>> folder:foo/.	match in foo only, and specifically not in foo/cur or foo/new.
>> folder:foo/new  match in foo/new, and specifically not in foo/cur (this
>> 		allows distinguishing between messages in cur and new).
>
> is "new" special cased here? or do you rely on it being a leaf
> directory?

A little bit of both I guess; not too bad.

An alternative might be to make the variant without the trailing /
recursive, so folder:foo would match all files in all subdirectories
under foo, including foo/new and foo/cur. This would be more compatible
with the current folder: prefix too.

Then, if you wanted to match without recursion, you'd have to have
"folder:foo/. OR folder:foo/new OR folder:foo/cur" assuming new and cur
are leaf nodes, and if not, with "/." at the end.

But you'd have to decide what to do with "folder:foo/" which would then
match nothing.

There's definitely room for thoughts and discussion.

>> folder:/	match everything.
>> folder:/.	match in top level maildir only.
>> folder:""	match in top level maildir, including cur/new.
>
> I could certainly support this UI, assuming the database bloat is not
> too bad.
>
> I started to wonder about using 3 prefixes instead, but then I read your
> message again and a light went on. ;).

\o/


BR,
Jani.


More information about the notmuch mailing list