--- /dev/null
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 3B844421192\r
+ for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 00:34:30 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id ajGJ58fCeSgZ for <notmuch@notmuchmail.org>;\r
+ Mon, 23 Jan 2012 00:34:29 -0800 (PST)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+ [131.215.239.19])\r
+ by olra.theworths.org (Postfix) with ESMTP id 664BC429E54\r
+ for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 00:34:29 -0800 (PST)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+ by fire-doxen-postvirus (Postfix) with ESMTP id EFC6C2E50A1D\r
+ for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 00:34:26 -0800 (PST)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from finestructure.net (cpe-76-174-137-84.socal.res.rr.com\r
+ [76.174.137.84]) (Authenticated sender: jrollins)\r
+ by fire-doxen-submit (Postfix) with ESMTP id 2889A2E50CCC\r
+ for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 00:34:25 -0800 (PST)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+ id 4B79EAF4; Mon, 23 Jan 2012 00:34:25 -0800 (PST)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into\r
+ two more generally useful functions\r
+Date: Mon, 23 Jan 2012 00:34:20 -0800\r
+Message-Id: <1327307665-23387-1-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.8.3\r
+In-Reply-To: <87pqea24z0.fsf@servo.finestructure.net>\r
+References: <87pqea24z0.fsf@servo.finestructure.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 23 Jan 2012 08:34:30 -0000\r
+\r
+Brake up notmuch-show-archive-thread-internal into two new functions:\r
+\r
+notmuch-show-tag-thread-internal: applies a tag to all messages in\r
+thread. If option remove flag is t, tags will be removed instead of\r
+added.\r
+\r
+notmuch-show-next-thread: moves to the next thread in the search\r
+result. If given a prefix, will show the next result, otherwise will\r
+just move to it in the search view.\r
+\r
+Two new interactive functions, notmuch-show-{add,remove}-tag-thread,\r
+are also added. Together, these provide a better suit of thread\r
+tagging and navigation tools.\r
+\r
+The higher level thread archiving functions are modified to use these\r
+new function.\r
+---\r
+ emacs/notmuch-show.el | 35 ++++++++++++++++++++++++++++-------\r
+ 1 files changed, 28 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index e6a5b31..9638f35 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1524,12 +1524,31 @@ argument, hide all of the messages."\r
+ (interactive)\r
+ (backward-button 1))\r
+ \r
+-(defun notmuch-show-archive-thread-internal (show-next)\r
+- ;; Remove the tag from the current set of messages.\r
++(defun notmuch-show-tag-thread-internal (tag &optional remove)\r
++ "Add tag to the current set of messages.\r
++\r
++If the remove switch is given, tags will be removed instead of\r
++added."\r
+ (goto-char (point-min))\r
+- (loop do (notmuch-show-remove-tag "inbox")\r
+- until (not (notmuch-show-goto-message-next)))\r
+- ;; Move to the next item in the search results, if any.\r
++ (let ((tag-function (if remove\r
++ 'notmuch-show-remove-tag\r
++ 'notmuch-show-add-tag)))\r
++ (loop do (funcall tag-function tag)\r
++ until (not (notmuch-show-goto-message-next)))))\r
++\r
++(defun notmuch-show-add-tag-thread (tag)\r
++ "Add tag to all messages in the current thread."\r
++ (interactive)\r
++ (notmuch-show-tag-thread-internal tag))\r
++\r
++(defun notmuch-show-remove-tag-thread (tag)\r
++ "Remove tag from all messages in the current thread."\r
++ (interactive)\r
++ (notmuch-show-tag-thread-internal tag t))\r
++\r
++(defun notmuch-show-next-thread (&optional show-next)\r
++ "Move to the next item in the search results, if any."\r
++ (interactive "P")\r
+ (let ((parent-buffer notmuch-show-parent-buffer))\r
+ (notmuch-kill-this-buffer)\r
+ (if parent-buffer\r
+@@ -1551,12 +1570,14 @@ being delivered to the same thread. It does not archive the\r
+ entire thread, but only the messages shown in the current\r
+ buffer."\r
+ (interactive)\r
+- (notmuch-show-archive-thread-internal t))\r
++ (notmuch-show-remove-tag-thread "inbox")\r
++ (notmuch-show-next-thread t))\r
+ \r
+ (defun notmuch-show-archive-thread-then-exit ()\r
+ "Archive each message in thread, then exit back to search results."\r
+ (interactive)\r
+- (notmuch-show-archive-thread-internal nil))\r
++ (notmuch-show-remove-tag-thread "inbox")\r
++ (notmuch-show-next-thread))\r
+ \r
+ (defun notmuch-show-stash-cc ()\r
+ "Copy CC field of current message to kill-ring."\r
+-- \r
+1.7.8.3\r
+\r