[PATCH 2/4] emacs: repurpose notmuch-show-archive-thread-internal function for general thread tagging
Jameson Graef Rollins
jrollins at finestructure.net
Sat Jan 7 14:28:12 PST 2012
Instead of having a function that is only used for archiving a thread,
we instead make it useful for any tagging operation. The new
function, notmuch-show-tag-thread-internal, now takes two more
arguments, for the "sign" of the tagging operation ("-" or "+"), and
the tag to be added or removed. This will allow this function to be
used for any generic thread tagging operation.
The higher level functions that call this function are modified
accordingly.
---
emacs/notmuch-show.el | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5502efd..1e16f05 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1414,20 +1414,26 @@ argument, hide all of the messages."
(interactive)
(backward-button 1))
-(defun notmuch-show-archive-thread-internal (show-next)
+(defun notmuch-show-tag-thread-internal (sign tag show-next)
;; Remove the tag from the current set of messages.
(goto-char (point-min))
- (loop do (notmuch-show-remove-tag "inbox")
- until (not (notmuch-show-goto-message-next)))
- ;; Move to the next item in the search results, if any.
- (let ((parent-buffer notmuch-show-parent-buffer))
- (notmuch-kill-this-buffer)
- (if parent-buffer
- (progn
- (switch-to-buffer parent-buffer)
- (forward-line)
- (if show-next
- (notmuch-search-show-thread))))))
+ (let ((tag-function))
+ (cond
+ ((string= sign "-")
+ (setq tag-function 'notmuch-show-remove-tag))
+ ((string= sign "+")
+ (setq tag-function 'notmuch-show-add-tag)))
+ (loop do (funcall tag-function tag)
+ until (not (notmuch-show-goto-message-next)))
+ ;; Move to the next item in the search results, if any.
+ (let ((parent-buffer notmuch-show-parent-buffer))
+ (notmuch-kill-this-buffer)
+ (if parent-buffer
+ (progn
+ (switch-to-buffer parent-buffer)
+ (forward-line)
+ (if show-next
+ (notmuch-search-show-thread)))))))
(defun notmuch-show-archive-thread ()
"Archive each message in thread, then show next thread from search.
@@ -1441,12 +1447,12 @@ being delivered to the same thread. It does not archive the
entire thread, but only the messages shown in the current
buffer."
(interactive)
- (notmuch-show-archive-thread-internal t))
+ (notmuch-show-tag-thread-internal "-" "inbox" t))
(defun notmuch-show-archive-thread-then-exit ()
"Archive each message in thread, then exit back to search results."
(interactive)
- (notmuch-show-archive-thread-internal nil))
+ (notmuch-show-tag-thread-internal "-" "inbox" nil))
(defun notmuch-show-stash-cc ()
"Copy CC field of current message to kill-ring."
--
1.7.7.3
More information about the notmuch
mailing list