[PATCH v2 13/14] cli/reply: pass gmime message to munge detection
[notmuch-archives.git] / a8 / e2aa8e21398965fab1984ccca7822c34305486
1 Return-Path: <david@belohrad.ch>\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 03F8D431FC2\r
6         for <notmuch@notmuchmail.org>; Wed, 29 Oct 2014 06:30:58 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 WzFUNbkdgGU2 for <notmuch@notmuchmail.org>;\r
16         Wed, 29 Oct 2014 06:30:48 -0700 (PDT)\r
17 Received: from beesknees.cern.ch (beesknees.cern.ch [137.138.197.99])\r
18         (using TLSv1 with cipher AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id BF849431FB6\r
21         for <notmuch@notmuchmail.org>; Wed, 29 Oct 2014 06:30:47 -0700 (PDT)\r
22 Received: from belohrad by beesknees.cern.ch with local (Exim 4.84)\r
23         (envelope-from <david@belohrad.ch>)\r
24         id 1XjTKo-0003fC-9S; Wed, 29 Oct 2014 14:30:46 +0100\r
25 From: David Belohrad <david@belohrad.ch>\r
26 To: Eric Abrahamsen <eric@ericabrahamsen.net>, notmuch@notmuchmail.org\r
27 Subject: Re: [O] how to put into a journal info about the email sent\r
28 In-Reply-To: <uaxd29bt43r.fsf@beesknees.cern.ch>\r
29 References: <uaxh9yty1pm.fsf@beesknees.cern.ch>\r
30         <87ppdhh3rh.fsf@ericabrahamsen.net>\r
31         <m2k33p31yb.fsf@heart-of-gold.hh.sledj.net>\r
32         <87a94lh04t.fsf@ericabrahamsen.net>\r
33         <uaxd29bt43r.fsf@beesknees.cern.ch>\r
34 User-Agent: Notmuch/0.18~rc0+2~gbc64cdc (http://notmuchmail.org) Emacs/24.3.1\r
35         (x86_64-pc-linux-gnu)\r
36 Date: Wed, 29 Oct 2014 14:30:46 +0100\r
37 Message-ID: <uax4munt33t.fsf@beesknees.cern.ch>\r
38 MIME-Version: 1.0\r
39 Content-Type: text/plain\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: Wed, 29 Oct 2014 13:30:58 -0000\r
53 \r
54 a small correction. THIS:\r
55 \r
56 (kill-new (concat "[[notmuch:id:" (replace-regexp-in-string "[<>]" ""\r
57 msg-id) "][" (replace-regexp-in-string "[\]\\[]" "_" subject) "]]"))\r
58 \r
59 \r
60 is the correct way how to make the link and the subject into the kill\r
61 ring. The thing is, that subject must not contain [] (as e.g. [O]) so I\r
62 have replaced that by underscores. As well the message-id comes with <>\r
63 wrapping which has to be removed for the link to be working.\r
64 \r
65 .d.\r
66 \r
67 \r
68 \r
69 \r
70 David Belohrad <david@belohrad.ch> writes:\r
71 \r
72 > dear all,\r
73 >\r
74 > thanks for fruitful hints. Based on what you've done I have setup it as\r
75 > follows:\r
76 >\r
77 > 1) the capture template, which uses clipboard buffer to setup the\r
78 >    data. So my org-capture-templates contains this entry:\r
79 >    \r
80 >    ("@" "Email outgoing sync. USED INTERNALLY" entry (file+datetree (concat my-org-files "emails_sent.org"))\r
81 >    "* EMAIL %c :EMAIL:\n%?\nEntered on %T\n")\r
82 >\r
83 > 2) function which generates the notmuch link based on the message id:\r
84 >\r
85 >   (defun org-notmuch-track-outgoing-emails()\r
86 >          (save-restriction\r
87 >          (message-narrow-to-headers)\r
88 >             (let ((link (mail-fetch-field "Message-ID"))\r
89 >                   (subject (mail-fetch-field "Subject"))\r
90 >                   (to (mail-fetch-field "To"))\r
91 >                   (date (mail-fetch-field "Date"))\r
92 >                   (msg-id (mail-fetch-field "Message-ID"))\r
93 >                   ;; `mail-fetch-field'. Construct date-ts and date-ts-ia with\r
94 >                   ;;(date-ts (format-time-string (org-time-stamp-format t [t]) (date-to-time (mail-fetch-field "Date"))))\r
95 >                   )\r
96 >                   (if link\r
97 >                       ;; messageid exists, we can link it\r
98 >                       (kill-new (concat "[[notmuch:id:" msg-id "][" subject "]]")))\r
99 >             ;; use special template to fill in\r
100 >                   (org-capture nil "@")\r
101 >                     )\r
102 >                   )\r
103 >             )\r
104 >\r
105 > 3) hook to run the function when headers are created:\r
106 >\r
107 > (add-hook 'message-header-hook 'org-notmuch-track-outgoing-emails)\r
108 >\r
109 >\r
110 >\r
111 > The three what they do is that whenever I send an email, a new diary\r
112 > style entry is setup in the editting buffer, where the timestamp, email\r
113 > link and an EMAIL tag are already pre-filled. So unless I want to add\r
114 > another tags, sending email is by default a -two times- C-c C-c combo. \r
115 >\r
116 > Bettern than nothing, but still far from being perfect due to two\r
117 > things:\r
118 >\r
119 > - 'standard' behaviour is, that the email sent becomes read-only so with\r
120 >   'q' keystroke I can bury the buffer with the email. However when I\r
121 >   have implemented this, I have noticed that when I 'confirm' the\r
122 >   template, I go back into the buffer 'sent mail to...', but this the\r
123 >   *THE BUFFER IS NOT READ ONLY* and 'q' will just generate a character,\r
124 >   and then I have to kill this buffer using C-x k with additional 'yes'\r
125 >   because the buffer was modified. Quite annoying and I don't know how\r
126 >   to resolve this\r
127 >\r
128 > - second thing is, that I'd like to avoid at all opening the capture\r
129 >   template and just dump it into the file without any modifications\r
130 >   ongoing. The only 'modification' which comes into my mind is a setup\r
131 >   of an additional tag describing the email being attached to some\r
132 >   project...\r
133 >\r
134 > Any help on those two is highly appreciated :)\r
135 >\r
136 > .d.\r
137 >\r
138 >\r
139 >\r
140 > Eric Abrahamsen <eric@ericabrahamsen.net> writes:\r
141 >\r
142 >> David Edmondson <dme@dme.org> writes:\r
143 >>\r
144 >>> On Fri, Oct 24 2014, Eric Abrahamsen wrote:\r
145 >>>> David Belohrad <david@belohrad.ch> writes:\r
146 >>>>\r
147 >>>>> Dear All,\r
148 >>>>>\r
149 >>>>> i'm using org. And I'm using notmuch (that's why I address both mailing\r
150 >>>>> lists). Now, writing an email in everyday bussiness requires a\r
151 >>>>> non-significant time of your workhours. So I'd like to have this event\r
152 >>>>> in my org agenda. So any time I send some email with a given subject,\r
153 >>>>> I'd like to 'automatically' entry the information about it into\r
154 >>>>> e.g. sentmails.org in form of a diary entry, with appropriate tag.\r
155 >>>>\r
156 >>>> I do something like this in Gnorb, which I'd recommend you use except\r
157 >>>> it's mostly Gnus specific.\r
158 >>>>\r
159 >>>> I do it in two parts, but you could do it in one. Basically I add a\r
160 >>>> function to the `message-header-hook' (which ensures that all the\r
161 >>>> message headers have been generated properly).\r
162 >>>\r
163 >>> Does `message-generate-headers-first' not do what you want for this\r
164 >>> specific part?\r
165 >>\r
166 >> Yeah, I think I looked at that previously. But this thing is going in a\r
167 >> hook anyway, might as well use the hook that *doesn't* require me to\r
168 >> call that function explicitly.\r
169 >>\r
170 >>>> Obviously the downside is that, without a "Gcc:" header, org can't\r
171 >>>> actually make a real link to the message. It doesn't know where it's\r
172 >>>> going to be. However if you know that all your sent messages can be\r
173 >>>> reached with a link that looks like "notmuch:id#Message-id", then you\r
174 >>>> can make that yourself in your org capture template with something like\r
175 >>>\r
176 >>> As you suggest, know the message-id should be good enough to generate a\r
177 >>> notmuch link, though you may have to wait for the notmuch index to be\r
178 >>> updated for the link to be valid.\r
179 >>\r
180 >> Yup, I've got the same issue with nnimap -- you have to wait for the\r
181 >> next sync to get access to the message. So far it hasn't been a problem,\r
182 >> though.\r
183 >>\r
184 >> _______________________________________________\r
185 >> notmuch mailing list\r
186 >> notmuch@notmuchmail.org\r
187 >> http://notmuchmail.org/mailman/listinfo/notmuch\r