aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@MIT.EDU>2013-10-22 20:21:56 -0400
committerGravatar David Bremner <bremner@debian.org>2013-10-25 21:26:13 -0300
commit47792533b37b24d353aa351c303562860509441b (patch)
treeeeb8e6eff82d691be32f727ff7bb0806b02a70b2 /emacs
parent0f8d5b6b0e7597346f0228145069706a7866f6f1 (diff)
emacs: Use interactive specifications for tag changes in show
This modifies all tagging operations in show to call `notmuch-read-tag-changes' in their interactive specification to input tag changes, rather than depending on lower-level functions to prompt for tag changes regardless of their calling context. Besides being more Elispy and providing a more consistent programmatic API, this enables callers to provide two call site-specific pieces of information: an appropriate prompt, and the set of visible tags. The prompt lets us differentiate * from +/-. Providing visible tags enables a more consistent user experience than retrieving the (potentially different) tags from the database, and avoids a round-trip to the CLI and database.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el33
1 files changed, 20 insertions, 13 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8ba81676..81ee87a8 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1782,23 +1782,28 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'."
(notmuch-tag (notmuch-show-get-message-id) tag-changes)
(notmuch-show-set-tags new-tags))))
-(defun notmuch-show-tag (&optional tag-changes)
+(defun notmuch-show-tag (tag-changes)
"Change tags for the current message.
See `notmuch-tag' for information on the format of TAG-CHANGES."
- (interactive)
- (let* ((tag-changes (notmuch-tag (notmuch-show-get-message-id) tag-changes))
- (current-tags (notmuch-show-get-tags))
+ (interactive (list (notmuch-read-tag-changes (notmuch-show-get-tags)
+ "Tag message")))
+ (notmuch-tag (notmuch-show-get-message-id) tag-changes)
+ (let* ((current-tags (notmuch-show-get-tags))
(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 (&optional tag-changes)
+(defun notmuch-show-tag-all (tag-changes)
"Change tags for all messages in the current show buffer.
See `notmuch-tag' for information on the format of TAG-CHANGES."
- (interactive)
- (setq tag-changes (notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes))
+ (interactive
+ (list (let (tags)
+ (notmuch-show-mapc
+ (lambda () (setq tags (append (notmuch-show-get-tags) tags))))
+ (notmuch-read-tag-changes tags "Tag thread"))))
+ (notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
(notmuch-show-mapc
(lambda ()
(let* ((current-tags (notmuch-show-get-tags))
@@ -1806,19 +1811,21 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."
(unless (equal current-tags new-tags)
(notmuch-show-set-tags new-tags))))))
-(defun notmuch-show-add-tag ()
+(defun notmuch-show-add-tag (tag-changes)
"Change tags for the current message (defaulting to add).
Same as `notmuch-show-tag' but sets initial input to '+'."
- (interactive)
- (notmuch-show-tag "+"))
+ (interactive
+ (list (notmuch-read-tag-changes (notmuch-show-get-tags) "Tag message" "+")))
+ (notmuch-show-tag tag-changes))
-(defun notmuch-show-remove-tag ()
+(defun notmuch-show-remove-tag (tag-changes)
"Change tags for the current message (defaulting to remove).
Same as `notmuch-show-tag' but sets initial input to '-'."
- (interactive)
- (notmuch-show-tag "-"))
+ (interactive
+ (list (notmuch-read-tag-changes (notmuch-show-get-tags) "Tag message" "-")))
+ (notmuch-show-tag tag-changes))
(defun notmuch-show-toggle-visibility-headers ()
"Toggle the visibility of the current message headers."