This seems like a good idea. On Tue, 3 Jan 2012 20:29:06 +0200, Jani Nikula 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.