Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / de / 55e2b0351a84ccdc759a40e97dfdc614cba357
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 3B844421192\r
6         for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 00:34:30 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \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 ajGJ58fCeSgZ for <notmuch@notmuchmail.org>;\r
16         Mon, 23 Jan 2012 00:34:29 -0800 (PST)\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
18         [131.215.239.19])\r
19         by olra.theworths.org (Postfix) with ESMTP id 664BC429E54\r
20         for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 00:34:29 -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 EFC6C2E50A1D\r
23         for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 00:34:26 -0800 (PST)\r
24 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
25 Received: from finestructure.net (cpe-76-174-137-84.socal.res.rr.com\r
26         [76.174.137.84]) (Authenticated sender: jrollins)\r
27         by fire-doxen-submit (Postfix) with ESMTP id 2889A2E50CCC\r
28         for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 00:34:25 -0800 (PST)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id 4B79EAF4; Mon, 23 Jan 2012 00:34:25 -0800 (PST)\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>\r
33 Subject: [PATCH 1/6] emacs: break up notmuch-show-archive-thread-internal into\r
34         two more generally useful functions\r
35 Date: Mon, 23 Jan 2012 00:34:20 -0800\r
36 Message-Id: <1327307665-23387-1-git-send-email-jrollins@finestructure.net>\r
37 X-Mailer: git-send-email 1.7.8.3\r
38 In-Reply-To: <87pqea24z0.fsf@servo.finestructure.net>\r
39 References: <87pqea24z0.fsf@servo.finestructure.net>\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Mon, 23 Jan 2012 08:34:30 -0000\r
53 \r
54 Brake up notmuch-show-archive-thread-internal into two new functions:\r
55 \r
56 notmuch-show-tag-thread-internal: applies a tag to all messages in\r
57 thread.  If option remove flag is t, tags will be removed instead of\r
58 added.\r
59 \r
60 notmuch-show-next-thread: moves to the next thread in the search\r
61 result.  If given a prefix, will show the next result, otherwise will\r
62 just move to it in the search view.\r
63 \r
64 Two new interactive functions, notmuch-show-{add,remove}-tag-thread,\r
65 are also added.  Together, these provide a better suit of thread\r
66 tagging and navigation tools.\r
67 \r
68 The higher level thread archiving functions are modified to use these\r
69 new function.\r
70 ---\r
71  emacs/notmuch-show.el |   35 ++++++++++++++++++++++++++++-------\r
72  1 files changed, 28 insertions(+), 7 deletions(-)\r
73 \r
74 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
75 index e6a5b31..9638f35 100644\r
76 --- a/emacs/notmuch-show.el\r
77 +++ b/emacs/notmuch-show.el\r
78 @@ -1524,12 +1524,31 @@ argument, hide all of the messages."\r
79    (interactive)\r
80    (backward-button 1))\r
81  \r
82 -(defun notmuch-show-archive-thread-internal (show-next)\r
83 -  ;; Remove the tag from the current set of messages.\r
84 +(defun notmuch-show-tag-thread-internal (tag &optional remove)\r
85 +  "Add tag to the current set of messages.\r
86 +\r
87 +If the remove switch is given, tags will be removed instead of\r
88 +added."\r
89    (goto-char (point-min))\r
90 -  (loop do (notmuch-show-remove-tag "inbox")\r
91 -       until (not (notmuch-show-goto-message-next)))\r
92 -  ;; Move to the next item in the search results, if any.\r
93 +  (let ((tag-function (if remove\r
94 +                         'notmuch-show-remove-tag\r
95 +                       'notmuch-show-add-tag)))\r
96 +    (loop do (funcall tag-function tag)\r
97 +         until (not (notmuch-show-goto-message-next)))))\r
98 +\r
99 +(defun notmuch-show-add-tag-thread (tag)\r
100 +  "Add tag to all messages in the current thread."\r
101 +  (interactive)\r
102 +  (notmuch-show-tag-thread-internal tag))\r
103 +\r
104 +(defun notmuch-show-remove-tag-thread (tag)\r
105 +  "Remove tag from all messages in the current thread."\r
106 +  (interactive)\r
107 +  (notmuch-show-tag-thread-internal tag t))\r
108 +\r
109 +(defun notmuch-show-next-thread (&optional show-next)\r
110 +  "Move to the next item in the search results, if any."\r
111 +  (interactive "P")\r
112    (let ((parent-buffer notmuch-show-parent-buffer))\r
113      (notmuch-kill-this-buffer)\r
114      (if parent-buffer\r
115 @@ -1551,12 +1570,14 @@ being delivered to the same thread. It does not archive the\r
116  entire thread, but only the messages shown in the current\r
117  buffer."\r
118    (interactive)\r
119 -  (notmuch-show-archive-thread-internal t))\r
120 +  (notmuch-show-remove-tag-thread "inbox")\r
121 +  (notmuch-show-next-thread t))\r
122  \r
123  (defun notmuch-show-archive-thread-then-exit ()\r
124    "Archive each message in thread, then exit back to search results."\r
125    (interactive)\r
126 -  (notmuch-show-archive-thread-internal nil))\r
127 +  (notmuch-show-remove-tag-thread "inbox")\r
128 +  (notmuch-show-next-thread))\r
129  \r
130  (defun notmuch-show-stash-cc ()\r
131    "Copy CC field of current message to kill-ring."\r
132 -- \r
133 1.7.8.3\r
134 \r