[PATCH 8/6] emacs: use message ids instead of thread id in `notmuch-show-operate-all'
Austin Clements
amdragon at MIT.EDU
Sun Jan 29 15:11:20 PST 2012
Eighth in the increasingly inaccurately named six patch series...
Quoth Dmitry Kurochkin on Jan 28 at 9:59 am:
> 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.
Are you planning to roll this into your earlier patch?
> ---
> 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."
`function' should be FUNCTION.
> + (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."
"currently shown" could mean visible on the screen, which is not what
you mean. You also don't mean "open messages". Maybe "Return all
message ids of messages in this show buffer"?
> + (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."
Same.
> + (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))
More information about the notmuch
mailing list