[PATCH 8/6] emacs: use message ids instead of thread id in `notmuch-show-operate-all'

Jani Nikula jani at nikula.org
Sat Jan 28 01:09:45 PST 2012


I guess this now includes the optimization of doing the tagging in a single
call to notmuch tag. (As opposed to calling it once per msg like it used to
be a while back.) There was some discussion about the cmdline length for
large threads potentially growing too big when I sent such an optimization
patch, shall we just ignore that and hope for the best? I guess an idea was
to limit to, say, a few hundred msg ids per command. (Again, sorry I can't
look up the earlier thread now.)

On Jan 28, 2012 8:00 AM, "Dmitry Kurochkin" <dmitry.kurochkin at gmail.com>
wrote:
>
> Before the change, `notmuch-show-operate-all' used thread id for
> "notmuch tag" search.  This could result in tagging unexpected
> messages that were added to the thread after the notmuch-show buffer
> was created.  The patch changes `notmuch-show-operate-all' to use ids
> of shown messages to fix this.
> ---
>  emacs/notmuch-show.el |   23 ++++++++++++++++++++++-
>  1 files changed, 22 insertions(+), 1 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 2ca4d92..e606224 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1170,6 +1170,15 @@ All currently available key bindings:
>     (notmuch-show-move-to-message-top)
>     t))
>
> +(defun notmuch-show-mapc (function)
> +  "Iterate through all messages with
> +`notmuch-show-goto-message-next' and call `function' for side
> +effects."
> +  (save-excursion
> +    (goto-char (point-min))
> +    (loop do (funcall function)
> +         while (notmuch-show-goto-message-next))))
> +
>  ;; Functions relating to the visibility of messages and their
>  ;; components.
>
> @@ -1222,6 +1231,18 @@ Some useful entries are:
>   "Return the message id of the current message."
>   (concat "id:\"" (notmuch-show-get-prop :id) "\""))
>
> +(defun notmuch-show-get-messages-ids ()
> +  "Return all message ids of currently shown messages."
> +  (let ((message-ids))
> +    (notmuch-show-mapc
> +     (lambda () (push (notmuch-show-get-message-id) message-ids)))
> +    message-ids))
> +
> +(defun notmuch-show-get-messages-ids-search ()
> +  "Return a search string for all message ids of currently shown
> +messages."
> +  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))
> +
>  ;; dme: Would it make sense to use a macro for many of these?
>
>  (defun notmuch-show-get-filename ()
> @@ -1496,7 +1517,7 @@ i.e. a list of tags to change with '+' and '-'
prefixes."
>  `Changed-tags' is a list of tag operations for \"notmuch tag\",
>  i.e. a list of tags to change with '+' and '-' prefixes."
>   (interactive (notmuch-select-tags-with-completion nil
notmuch-show-thread-id))
> -  (apply 'notmuch-tag notmuch-show-thread-id changed-tags)
> +  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search)
changed-tags)
>   (save-excursion
>     (goto-char (point-min))
>     (loop do (let* ((current-tags (notmuch-show-get-tags))
> --
> 1.7.8.3
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120128/def85d4b/attachment-0001.html>


More information about the notmuch mailing list