emacs: modify show tag functions to use new notmuch-tag interface

The main change here is to modify argument parsing so as to not force
tag-changes to be a list, and to let notmuch-tag handle prompting the
user when required.  doc strings are also updated and cleaned up.
This commit is contained in:
Jameson Graef Rollins 2012-04-14 11:52:53 -07:00 committed by David Bremner
parent dba0e53ea8
commit c1bcf5f8c0

View file

@ -1653,22 +1653,26 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'."
(let* ((current-tags (notmuch-show-get-tags)) (let* ((current-tags (notmuch-show-get-tags))
(new-tags (notmuch-update-tags current-tags tag-changes))) (new-tags (notmuch-update-tags current-tags tag-changes)))
(unless (equal current-tags new-tags) (unless (equal current-tags new-tags)
(apply 'notmuch-tag (notmuch-show-get-message-id) tag-changes) (funcall 'notmuch-tag (notmuch-show-get-message-id) tag-changes)
(notmuch-show-set-tags new-tags)))) (notmuch-show-set-tags new-tags))))
(defun notmuch-show-tag (&optional initial-input) (defun notmuch-show-tag (&optional tag-changes)
"Change tags for the current message, read input from the minibuffer." "Change tags for the current message.
See `notmuch-tag' for information on the format of TAG-CHANGES."
(interactive) (interactive)
(let ((tag-changes (notmuch-read-tag-changes (setq tag-changes (funcall 'notmuch-tag (notmuch-show-get-message-id) tag-changes))
initial-input (notmuch-show-get-message-id)))) (let* ((current-tags (notmuch-show-get-tags))
(apply 'notmuch-show-tag-message tag-changes))) (new-tags (notmuch-update-tags current-tags tag-changes)))
(unless (equal current-tags new-tags)
(notmuch-show-set-tags new-tags))))
(defun notmuch-show-tag-all (&rest tag-changes) (defun notmuch-show-tag-all (&optional tag-changes)
"Change tags for all messages in the current buffer. "Change tags for all messages in the current show buffer.
TAG-CHANGES is a list of tag operations for `notmuch-tag'." See `notmuch-tag' for information on the format of TAG-CHANGES."
(interactive (notmuch-read-tag-changes nil notmuch-show-thread-id)) (interactive)
(apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes) (setq tag-changes (funcall 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes))
(notmuch-show-mapc (notmuch-show-mapc
(lambda () (lambda ()
(let* ((current-tags (notmuch-show-get-tags)) (let* ((current-tags (notmuch-show-get-tags))