[PATCH] introduce new.rename_tags for renamed (moved) messages

David Bremner david at tethera.net
Fri Sep 7 17:47:26 PDT 2018


Michael J Gruber <git at grubix.eu> writes:

>
> Introduce new.rename_tags (default: not set) which are added by `notmuch
> new` to renamed messages. This allows to act upon renames, e.g. to keep
> the IMAP folder structure in sync with tags with a tool like `afew` or
> homecooked scripts simply by filtering for this tag in the same ways as
> one would filter for new messages using new.tags.

The idea seems OK to me. I was hoping for some more feedback from
others, but here we are.

> +        const char **tag;
>  	add_files_state->renamed_messages++;
> +	notmuch_message_freeze (message);
> +
> +	for (tag = add_files_state->rename_tags; tag != NULL && *tag != NULL; tag++) {
> +	    notmuch_message_add_tag (message, *tag);
> +	}
> +
> +

extra blank line

>  	if (add_files_state->synchronize_flags == true)
>  	    notmuch_message_maildir_flags_to_tags (message);
> +	notmuch_message_thaw (message);

Did you have a specific reason for putting the _thaw after the existing
maildir_flags_to_tags? It's probably not important, but if there's no
good reason it seems more natural before.

As a new feature this needs some tests before it can be merged.  You can
start by looking at the tests for new.tags for inspiration I guess
(T050-new.sh and T340-maildir-sync.sh).  One case that occured to me is
that when duplicate files (with the same message-id) exist, deleting one
of them is detected as a rename.


More information about the notmuch mailing list