1 Return-Path: <jrollins@finestructure.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 96B3E418C30
\r
6 for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 16:06:40 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id IB+-Npp6Vcny for <notmuch@notmuchmail.org>;
\r
16 Tue, 24 Jan 2012 16:06:38 -0800 (PST)
\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
19 by olra.theworths.org (Postfix) with ESMTP id 97ED1429E36
\r
20 for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 16:06:32 -0800 (PST)
\r
21 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
22 by fire-doxen-postvirus (Postfix) with ESMTP id 3D0A4328051
\r
23 for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 16:06:30 -0800 (PST)
\r
24 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new
\r
25 Received: from finestructure.net (DHCP-123-180.caltech.edu [131.215.123.180])
\r
26 (Authenticated sender: jrollins)
\r
27 by fire-doxen-submit (Postfix) with ESMTP id E7834328068
\r
28 for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 16:06:27 -0800 (PST)
\r
29 Received: by finestructure.net (Postfix, from userid 1000)
\r
30 id D2E312E5; Tue, 24 Jan 2012 16:06:27 -0800 (PST)
\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
33 Subject: [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal
\r
34 into two more generally useful functions
\r
35 Date: Tue, 24 Jan 2012 16:06:17 -0800
\r
36 Message-Id: <1327449983-23638-3-git-send-email-jrollins@finestructure.net>
\r
37 X-Mailer: git-send-email 1.7.8.3
\r
38 In-Reply-To: <1327449983-23638-2-git-send-email-jrollins@finestructure.net>
\r
39 References: <87pqea24z0.fsf@servo.finestructure.net>
\r
40 <1327449983-23638-1-git-send-email-jrollins@finestructure.net>
\r
41 <1327449983-23638-2-git-send-email-jrollins@finestructure.net>
\r
42 X-BeenThere: notmuch@notmuchmail.org
\r
43 X-Mailman-Version: 2.1.13
\r
45 List-Id: "Use and development of the notmuch mail system."
\r
46 <notmuch.notmuchmail.org>
\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
50 List-Post: <mailto:notmuch@notmuchmail.org>
\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
54 X-List-Received-Date: Wed, 25 Jan 2012 00:06:41 -0000
\r
56 Brake up notmuch-show-archive-thread-internal into two new functions:
\r
58 notmuch-show-tag-thread-internal: applies a tag to all messages in
\r
59 thread. If option remove flag is t, tags will be removed instead of
\r
62 notmuch-show-next-thread: moves to the next thread in the search
\r
63 result. If given a prefix, will show the next result, otherwise will
\r
64 just move to it in the search view.
\r
66 Two new interactive functions, notmuch-show-{add,remove}-tag-thread,
\r
67 are also added. Together, these provide a better suit of thread
\r
68 tagging and navigation tools.
\r
70 The higher level thread archiving functions are modified to use these
\r
73 emacs/notmuch-show.el | 46 +++++++++++++++++++++++++++++++++-------------
\r
74 1 files changed, 33 insertions(+), 13 deletions(-)
\r
76 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
77 index a0045fc..fb908b0 100644
\r
78 --- a/emacs/notmuch-show.el
\r
79 +++ b/emacs/notmuch-show.el
\r
80 @@ -1525,20 +1525,38 @@ argument, hide all of the messages."
\r
82 (backward-button 1))
\r
84 -(defun notmuch-show-archive-thread-internal (show-next)
\r
85 - ;; Remove the tag from the current set of messages.
\r
86 +(defun notmuch-show-tag-thread-internal (tag &optional remove)
\r
87 + "Add tag to the current set of messages.
\r
89 +If the remove switch is given, tags will be removed instead of
\r
91 (goto-char (point-min))
\r
92 - (loop do (notmuch-show-remove-tag "inbox")
\r
93 - until (not (notmuch-show-goto-message-next)))
\r
94 - ;; Move to the next item in the search results, if any.
\r
95 + (let ((tag-function (if remove
\r
96 + 'notmuch-show-remove-tag
\r
97 + 'notmuch-show-add-tag)))
\r
98 + (loop do (funcall tag-function tag)
\r
99 + until (not (notmuch-show-goto-message-next)))))
\r
101 +(defun notmuch-show-add-tag-thread (tag)
\r
102 + "Add tag to all messages in the current thread."
\r
104 + (notmuch-show-tag-thread-internal tag))
\r
106 +(defun notmuch-show-remove-tag-thread (tag)
\r
107 + "Remove tag from all messages in the current thread."
\r
109 + (notmuch-show-tag-thread-internal tag t))
\r
111 +(defun notmuch-show-next-thread (&optional show-next)
\r
112 + "Move to the next item in the search results, if any."
\r
113 + (interactive "P")
\r
114 (let ((parent-buffer notmuch-show-parent-buffer))
\r
115 (notmuch-kill-this-buffer)
\r
116 - (if parent-buffer
\r
118 - (switch-to-buffer parent-buffer)
\r
119 - (notmuch-search-next-thread)
\r
121 - (notmuch-search-show-thread))))))
\r
122 + (when parent-buffer
\r
123 + (switch-to-buffer parent-buffer)
\r
124 + (notmuch-search-next-thread)
\r
126 + (notmuch-search-show-thread)))))
\r
128 (defun notmuch-show-archive-thread ()
\r
129 "Archive each message in thread, then show next thread from search.
\r
130 @@ -1552,12 +1570,14 @@ being delivered to the same thread. It does not archive the
\r
131 entire thread, but only the messages shown in the current
\r
134 - (notmuch-show-archive-thread-internal t))
\r
135 + (notmuch-show-remove-tag-thread "inbox")
\r
136 + (notmuch-show-next-thread t))
\r
138 (defun notmuch-show-archive-thread-then-exit ()
\r
139 "Archive each message in thread, then exit back to search results."
\r
141 - (notmuch-show-archive-thread-internal nil))
\r
142 + (notmuch-show-remove-tag-thread "inbox")
\r
143 + (notmuch-show-next-thread))
\r
145 (defun notmuch-show-stash-cc ()
\r
146 "Copy CC field of current message to kill-ring."
\r