[PATCH v2 0/6] batch tagging support: "notmuch tag --stdin"

Jani Nikula jani at nikula.org
Wed Apr 18 11:58:38 PDT 2012


On Sun, 15 Apr 2012, David Bremner <david at tethera.net> wrote:
> Jani Nikula <jani at nikula.org> writes:
>
>
>> I'm totally fine with modifying the proposed format (e.g. change "T" to
>> "tag", make things compatible with a future general batch mode), but to
>> be absolutely clear: I will not implement a general batch command
>> mode. 
>
> I was thinking about the best way of making the interface extensible,
> and it might be better have a kind of modal interface, where some well
> defined escape at the beginning of the line introduces a mode switch.
> This has two apparent advantages: it avoids duplication of redundant
> information at the beginning of each line, and for input to a subcommand
> it could be optional.

Does it not worry you that such a modal format isn't much fun to filter
with regular command line tools?

> something like
>
> * tag
> +foo +bar msg.id at blah
> +glub -glog other.msg.id at blog
>
> vs
>
> * restore
> foo bar msg.id at blah
> glub glog other.msg.id at blog
>
> where a hypothetical general batch interface could take those two files
> concatenated together, and the "*" lines would be optional feeding to
> tag and restore respectively.

Restore currently has two modes of operation: with and without
--accumulate option. How would you specify that *outside* the file, if
the restore was done with the hypothetical general batch interface? And
if there was such an interface, we shouldn't have a dedicated restore
command for restoring such dump files, should we...? (It's useful to be
able to use the same dump file with/without --accumulate. See e.g. [1].)

> I guess the current proposal is to have the restore format and tag
> format a bit closer
>
> * restore
> +foo +bar msg.id at blah
> +glub +glog other.msg.id at blog

Something like that... though in my original idea the same dump file
could be fed to either tag or restore. They would interpret the file
using the same routine, but perform the tagging in slightly different
ways (mainly to keep restore very strict as it's a backup/restore
command).

> This looks like it would be a 2% space increase for my tags. I guess I
> could live with that. Another option would be to have the '+' be
> optional for tag as well; I suppose then tags starting with + would be
> ambiguous, which is probably a bad idea.

I'd like to keep the new format unambiguous if at all possible.

BR,
Jani.



[1] http://notmuchmail.org/howto/#index5h2



More information about the notmuch mailing list