Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / 21 / 6677b5f142dcf005b6984d7f09f2f8113e689c
1 Return-Path: <amdragon@mit.edu>\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 899B3431E64\r
6         for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 20:58:01 -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: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 8b7eqbADJEaD for <notmuch@notmuchmail.org>;\r
16         Sun, 29 Jan 2012 20:58:01 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
18         [18.9.25.13])\r
19         by olra.theworths.org (Postfix) with ESMTP id EB386431FBC\r
20         for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 20:58:00 -0800 (PST)\r
21 X-AuditID: 1209190d-b7fbf6d0000008ba-e0-4f262358f901\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id FB.AA.02234.853262F4; Sun, 29 Jan 2012 23:58:00 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q0U4vx6Q003387; \r
27         Sun, 29 Jan 2012 23:58:00 -0500\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0U4vv76029978\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Sun, 29 Jan 2012 23:57:58 -0500 (EST)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1RrjIj-0000WC-BR; Sun, 29 Jan 2012 23:57:09 -0500\r
37 Date: Sun, 29 Jan 2012 23:57:09 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
40 Subject: Re: [PATCH v2 10/13] emacs: use message ids instead of thread id in\r
41         `notmuch-show-operate-all'\r
42 Message-ID: <20120130045709.GN17991@mit.edu>\r
43 References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com>\r
44         <1327890382-548-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45         <1327890382-548-11-git-send-email-dmitry.kurochkin@gmail.com>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain; charset=us-ascii\r
48 Content-Disposition: inline\r
49 In-Reply-To: <1327890382-548-11-git-send-email-dmitry.kurochkin@gmail.com>\r
50 User-Agent: Mutt/1.5.21 (2010-09-15)\r
51 X-Brightmail-Tracker:\r
52  H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IRYrdT0Y1QVvM3ODJJzOLq1n52i+s3ZzI7\r
53         MHnsnHWX3ePZqlvMAUxRXDYpqTmZZalF+nYJXBlT2veyFHSLVDxoaGVqYJwt0MXIySEhYCLx\r
54         YvkKRghbTOLCvfVsXYxcHEIC+xglLh5bAeVsYJS4suURM0iVkMBJJon29zIQiSWMEouaJ7KC\r
55         JFgEVCVmff7EBGKzCWhIbNu/HGysiIChxK2Lr8CamQWkJb79bgarERbIlNjy7Qk7iM0roCPR\r
56         PmcuI8TQE4wS79vuMkEkBCVOznzCAtGsJXHj30ugOAfYoOX/OEDCnAJeEpufXwa7QVRARWLK\r
57         yW1sExiFZiHpnoWkexZC9wJG5lWMsim5Vbq5iZk5xanJusXJiXl5qUW6Rnq5mSV6qSmlmxhB\r
58         gc0pybuD8d1BpUOMAhyMSjy8Qf9U/YVYE8uKK3MPMUpyMCmJ8rooqfkL8SXlp1RmJBZnxBeV\r
59         5qQWH2KU4GBWEuF99BOonDclsbIqtSgfJiXNwaIkzquq9c5PSCA9sSQ1OzW1ILUIJivDwaEk\r
60         wXsMZKhgUWp6akVaZk4JQpqJgxNkOA/Q8LMgNbzFBYm5xZnpEPlTjIpS4rwfQBICIImM0jy4\r
61         XljiecUoDvSKMO8LkCoeYNKC634FNJgJaPBzBpCri0sSEVJSDYxuqn3pJxY4mUVEfN0ZHXdC\r
62         yPh6/GHNGt8rgs8E9StkGgW6zptx9iT4qv8Kma++vFZn7Z36/9cexZRL3d6eu2TnxbK/fVe4\r
63         K7plA78fCzWw+u2YenqHw0a2aRv9p/N0zv9xeOXtjpRis3fGb1u3/TyyXeGsCce9jjfZ3hP+\r
64         nb52JZ+rYJVskq8SS3FGoqEWc1FxIgC/vIC/FwMAAA==\r
65 Cc: notmuch@notmuchmail.org\r
66 X-BeenThere: notmuch@notmuchmail.org\r
67 X-Mailman-Version: 2.1.13\r
68 Precedence: list\r
69 List-Id: "Use and development of the notmuch mail system."\r
70         <notmuch.notmuchmail.org>\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
74 List-Post: <mailto:notmuch@notmuchmail.org>\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
77         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
78 X-List-Received-Date: Mon, 30 Jan 2012 04:58:01 -0000\r
79 \r
80 Quoth Dmitry Kurochkin on Jan 30 at  6:26 am:\r
81 > Before the change, `notmuch-show-operate-all' used thread id for\r
82 \r
83 notmuch-show-tag-all?\r
84 \r
85 > "notmuch tag" search.  This could result in tagging unexpected\r
86 > messages that were added to the thread after the notmuch-show buffer\r
87 > was created.  The patch changes `notmuch-show-operate-all' to use ids\r
88 > of shown messages to fix this.\r
89 > ---\r
90 \r
91 If you move this patch before the one that introduces\r
92 notmuch-show-tag-all, you could do it this way from the beginning.\r
93 \r
94 >  emacs/notmuch-show.el |   23 ++++++++++++++++++++++-\r
95 >  1 files changed, 22 insertions(+), 1 deletions(-)\r
96\r
97 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
98 > index 0d90c1e..b115a8f 100644\r
99 > --- a/emacs/notmuch-show.el\r
100 > +++ b/emacs/notmuch-show.el\r
101 > @@ -1170,6 +1170,15 @@ All currently available key bindings:\r
102 >      (notmuch-show-move-to-message-top)\r
103 >      t))\r
104 >  \r
105 > +(defun notmuch-show-mapc (function)\r
106 > +  "Iterate through all messages in the current thread with\r
107 > +`notmuch-show-goto-message-next' and call FUNCTION for side\r
108 > +effects."\r
109 > +  (save-excursion\r
110 > +    (goto-char (point-min))\r
111 > +    (loop do (funcall function)\r
112 > +       while (notmuch-show-goto-message-next))))\r
113 > +\r
114 >  ;; Functions relating to the visibility of messages and their\r
115 >  ;; components.\r
116 >  \r
117 > @@ -1222,6 +1231,18 @@ Some useful entries are:\r
118 >    "Return the message id of the current message."\r
119 >    (concat "id:\"" (notmuch-show-get-prop :id) "\""))\r
120 >  \r
121 > +(defun notmuch-show-get-messages-ids ()\r
122 > +  "Return all message ids of messages in the current thread."\r
123 > +  (let ((message-ids))\r
124 > +    (notmuch-show-mapc\r
125 > +     (lambda () (push (notmuch-show-get-message-id) message-ids)))\r
126 > +    message-ids))\r
127 > +\r
128 > +(defun notmuch-show-get-messages-ids-search ()\r
129 > +  "Return a search string for all message ids of messages in the\r
130 > +current thread."\r
131 > +  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))\r
132 > +\r
133 >  ;; dme: Would it make sense to use a macro for many of these?\r
134 >  \r
135 >  (defun notmuch-show-get-filename ()\r
136 > @@ -1494,7 +1515,7 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'."\r
137 >  \r
138 >  TAG-CHANGES is a list of tag operations for `notmuch-tag'."\r
139 >    (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))\r
140 > -  (apply 'notmuch-tag notmuch-show-thread-id tag-changes)\r
141 > +  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)\r
142 >    (save-excursion\r
143 >      (goto-char (point-min))\r
144 >      (loop do (let* ((current-tags (notmuch-show-get-tags))\r