From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] contrib: pick: thread tagging (including archiving) implemented
Date: Sat, 8 Dec 2012 12:48:34 +0000 [thread overview]
Message-ID: <1354970914-18342-3-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1354970914-18342-1-git-send-email-markwalters1009@gmail.com>
Previously pick had no actions based on the entire thread: this adds
some. Note in this version '*' is bound to `tag thread' which is not
consistent with search or show. However it still might be the most
natural thing (as it is similar to running * in the show pane).
---
contrib/notmuch-pick/notmuch-pick.el | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 77e15bb..23442b9 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -173,6 +173,7 @@
(define-key map "q" 'notmuch-pick-quit)
(define-key map "x" 'notmuch-pick-quit)
(define-key map "?" 'notmuch-help)
+ (define-key map "A" 'notmuch-pick-archive-thread)
(define-key map "a" 'notmuch-pick-archive-message-then-next)
(define-key map "=" 'notmuch-pick-refresh-view)
(define-key map "s" 'notmuch-pick-to-search)
@@ -188,6 +189,7 @@
(define-key map "|" 'notmuch-pick-pipe-message)
(define-key map "-" 'notmuch-pick-remove-tag)
(define-key map "+" 'notmuch-pick-add-tag)
+ (define-key map "*" 'notmuch-pick-tag-thread)
(define-key map " " 'notmuch-pick-scroll-or-next)
(define-key map "b" 'notmuch-pick-scroll-message-window-back)
map))
@@ -579,6 +581,34 @@ than only the current message."
"Return a search string for all message ids of messages in the
current thread."
(mapconcat 'identity (notmuch-pick-get-messages-ids-thread) " or "))
+
+(defun notmuch-pick-tag-thread (&optional tag-changes)
+ "Tag all messages in the current thread"
+ (interactive)
+ (setq tag-changes (funcall 'notmuch-tag (notmuch-pick-get-messages-ids-thread-search) tag-changes))
+ (notmuch-pick-thread-mapc
+ (lambda () (notmuch-pick-tag-update-display tag-changes))))
+
+(defun notmuch-pick-archive-thread (&optional unarchive)
+ "Archive each message in thread.
+
+Archive each message currently shown by applying the tag changes
+in `notmuch-archive-tags' to each (remove the \"inbox\" tag by
+default). If a prefix argument is given, the messages will be
+\"unarchived\", i.e. the tag changes in `notmuch-archive-tags'
+will be reversed.
+
+Note: This command is safe from any race condition of new messages
+being delivered to the same thread. It does not archive the
+entire thread, but only the messages shown in the current
+buffer."
+ (interactive "P")
+ (when notmuch-archive-tags
+ (notmuch-pick-tag-thread
+ (notmuch-tag-change-list notmuch-archive-tags unarchive))))
+
+;; Functions below here display the pick buffer itself.
+
(defun notmuch-pick-clean-address (address)
"Try to clean a single email ADDRESS for display. Return
AUTHOR_NAME if present, otherwise return AUTHOR_EMAIL. Return
--
1.7.9.1
next prev parent reply other threads:[~2012-12-08 12:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-08 12:48 [PATCH 0/2] Add some thread based actions to pick Mark Walters
2012-12-08 12:48 ` [PATCH 1/2] contrib: pick: add thread based utility functions Mark Walters
2013-05-12 12:06 ` David Bremner
2013-05-27 7:35 ` Mark Walters
2013-06-01 12:36 ` David Bremner
2012-12-08 12:48 ` Mark Walters [this message]
2013-06-01 19:48 ` [PATCH 2/2] contrib: pick: thread tagging (including archiving) implemented David Bremner
2013-06-01 21:45 ` Mark Walters
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1354970914-18342-3-git-send-email-markwalters1009@gmail.com \
--to=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).