[PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more...
authorJameson Graef Rollins <jrollins@finestructure.net>
Wed, 25 Jan 2012 00:06:17 +0000 (16:06 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:10 +0000 (09:43 -0800)
e4/7ca9d4e41cd729cc82b4d9d53922c3ecb757be [new file with mode: 0644]

diff --git a/e4/7ca9d4e41cd729cc82b4d9d53922c3ecb757be b/e4/7ca9d4e41cd729cc82b4d9d53922c3ecb757be
new file mode 100644 (file)
index 0000000..fd5aa94
--- /dev/null
@@ -0,0 +1,149 @@
+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 96B3E418C30\r
+       for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 16:06:40 -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 IB+-Npp6Vcny for <notmuch@notmuchmail.org>;\r
+       Tue, 24 Jan 2012 16:06:38 -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 97ED1429E36\r
+       for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 16:06:32 -0800 (PST)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by fire-doxen-postvirus (Postfix) with ESMTP id 3D0A4328051\r
+       for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 16:06:30 -0800 (PST)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from finestructure.net (DHCP-123-180.caltech.edu [131.215.123.180])\r
+       (Authenticated sender: jrollins)\r
+       by fire-doxen-submit (Postfix) with ESMTP id E7834328068\r
+       for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 16:06:27 -0800 (PST)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id D2E312E5; Tue, 24 Jan 2012 16:06:27 -0800 (PST)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal\r
+       into two more generally useful functions\r
+Date: Tue, 24 Jan 2012 16:06:17 -0800\r
+Message-Id: <1327449983-23638-3-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.8.3\r
+In-Reply-To: <1327449983-23638-2-git-send-email-jrollins@finestructure.net>\r
+References: <87pqea24z0.fsf@servo.finestructure.net>\r
+       <1327449983-23638-1-git-send-email-jrollins@finestructure.net>\r
+       <1327449983-23638-2-git-send-email-jrollins@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: Wed, 25 Jan 2012 00:06:41 -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 |   46 +++++++++++++++++++++++++++++++++-------------\r
+ 1 files changed, 33 insertions(+), 13 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index a0045fc..fb908b0 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1525,20 +1525,38 @@ 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
+-      (progn\r
+-        (switch-to-buffer parent-buffer)\r
+-        (notmuch-search-next-thread)\r
+-        (if show-next\r
+-            (notmuch-search-show-thread))))))\r
++    (when parent-buffer\r
++      (switch-to-buffer parent-buffer)\r
++      (notmuch-search-next-thread)\r
++      (if show-next\r
++        (notmuch-search-show-thread)))))\r
\r
+ (defun notmuch-show-archive-thread ()\r
+   "Archive each message in thread, then show next thread from search.\r
+@@ -1552,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