[PATCH] emacs: call "notmuch tag" only once when archiving a thread

David Edmondson dme at dme.org
Wed Jan 4 06:13:05 PST 2012


This seems like a good idea.

On Tue,  3 Jan 2012 20:29:06 +0200, Jani Nikula <jani at nikula.org> wrote:
> On the downside, IIRC Xapian does not perform very well if the query
> (in this case a lot of message-ids OR'd together) is very big. It is
> unknown to me at which point this approach would become slower than
> the original one by one tagging approach, if ever.

Unless this limit is quite small (<1000), I'd be inclined not to worry
about it.

> Also, this introduces a limitation to the number of messages that can
> be archived at the same time (through ARG_MAX limiting the command
> line). At least on Linux this seems more like a theoretical limitation
> than a real one.

What's the failure mode when this does happen?

> +  (let ((message-ids))

No need for both sets of brackets:

   (let (message-ids)

is sufficient.

> +    (loop do
> +	  (let* ((current-tags (notmuch-show-get-tags))
> +		 (new-tags (notmuch-show-del-tags-worker current-tags toremove)))
> +	    (unless (equal current-tags new-tags)
> +	      (add-to-list 'message-ids (notmuch-show-get-message-id))))
> +	  until (not (notmuch-show-goto-message-next)))

`loop' has the ability to accumulate results, which would probably be
cleaner than `add-to-list'. See 'Accumulation Clauses' in the emacs cl
info.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120104/6b6bc8f6/attachment.pgp>


More information about the notmuch mailing list