--- /dev/null
+Return-Path: <david@belohrad.ch>\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 06AA9431FC2\r
+ for <notmuch@notmuchmail.org>; Wed, 29 Oct 2014 06:09:27 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 hn0l+g7BJXhd for <notmuch@notmuchmail.org>;\r
+ Wed, 29 Oct 2014 06:09:18 -0700 (PDT)\r
+Received: from beesknees.cern.ch (beesknees.cern.ch [137.138.197.99])\r
+ (using TLSv1 with cipher AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id C8F30431FB6\r
+ for <notmuch@notmuchmail.org>; Wed, 29 Oct 2014 06:09:18 -0700 (PDT)\r
+Received: from belohrad by beesknees.cern.ch with local (Exim 4.84)\r
+ (envelope-from <david@belohrad.ch>)\r
+ id 1XjSzx-0003Sd-1n; Wed, 29 Oct 2014 14:09:13 +0100\r
+From: David Belohrad <david@belohrad.ch>\r
+To: Eric Abrahamsen <eric@ericabrahamsen.net>, notmuch@notmuchmail.org\r
+Subject: Re: [O] how to put into a journal info about the email sent\r
+In-Reply-To: <87a94lh04t.fsf@ericabrahamsen.net>\r
+References: <uaxh9yty1pm.fsf@beesknees.cern.ch>\r
+ <87ppdhh3rh.fsf@ericabrahamsen.net>\r
+ <m2k33p31yb.fsf@heart-of-gold.hh.sledj.net>\r
+ <87a94lh04t.fsf@ericabrahamsen.net>\r
+User-Agent: Notmuch/0.18~rc0+2~gbc64cdc (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Wed, 29 Oct 2014 14:09:12 +0100\r
+Message-ID: <uaxd29bt43r.fsf@beesknees.cern.ch>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+Cc: emacs-orgmode@gnu.org\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, 29 Oct 2014 13:09:27 -0000\r
+\r
+dear all,\r
+\r
+thanks for fruitful hints. Based on what you've done I have setup it as\r
+follows:\r
+\r
+1) the capture template, which uses clipboard buffer to setup the\r
+ data. So my org-capture-templates contains this entry:\r
+ \r
+ ("@" "Email outgoing sync. USED INTERNALLY" entry (file+datetree (concat my-org-files "emails_sent.org"))\r
+ "* EMAIL %c :EMAIL:\n%?\nEntered on %T\n")\r
+\r
+2) function which generates the notmuch link based on the message id:\r
+\r
+ (defun org-notmuch-track-outgoing-emails()\r
+ (save-restriction\r
+ (message-narrow-to-headers)\r
+ (let ((link (mail-fetch-field "Message-ID"))\r
+ (subject (mail-fetch-field "Subject"))\r
+ (to (mail-fetch-field "To"))\r
+ (date (mail-fetch-field "Date"))\r
+ (msg-id (mail-fetch-field "Message-ID"))\r
+ ;; `mail-fetch-field'. Construct date-ts and date-ts-ia with\r
+ ;;(date-ts (format-time-string (org-time-stamp-format t [t]) (date-to-time (mail-fetch-field "Date"))))\r
+ )\r
+ (if link\r
+ ;; messageid exists, we can link it\r
+ (kill-new (concat "[[notmuch:id:" msg-id "][" subject "]]")))\r
+ ;; use special template to fill in\r
+ (org-capture nil "@")\r
+ )\r
+ )\r
+ )\r
+\r
+3) hook to run the function when headers are created:\r
+\r
+(add-hook 'message-header-hook 'org-notmuch-track-outgoing-emails)\r
+\r
+\r
+\r
+The three what they do is that whenever I send an email, a new diary\r
+style entry is setup in the editting buffer, where the timestamp, email\r
+link and an EMAIL tag are already pre-filled. So unless I want to add\r
+another tags, sending email is by default a -two times- C-c C-c combo. \r
+\r
+Bettern than nothing, but still far from being perfect due to two\r
+things:\r
+\r
+- 'standard' behaviour is, that the email sent becomes read-only so with\r
+ 'q' keystroke I can bury the buffer with the email. However when I\r
+ have implemented this, I have noticed that when I 'confirm' the\r
+ template, I go back into the buffer 'sent mail to...', but this the\r
+ *THE BUFFER IS NOT READ ONLY* and 'q' will just generate a character,\r
+ and then I have to kill this buffer using C-x k with additional 'yes'\r
+ because the buffer was modified. Quite annoying and I don't know how\r
+ to resolve this\r
+\r
+- second thing is, that I'd like to avoid at all opening the capture\r
+ template and just dump it into the file without any modifications\r
+ ongoing. The only 'modification' which comes into my mind is a setup\r
+ of an additional tag describing the email being attached to some\r
+ project...\r
+\r
+Any help on those two is highly appreciated :)\r
+\r
+.d.\r
+\r
+\r
+\r
+Eric Abrahamsen <eric@ericabrahamsen.net> writes:\r
+\r
+> David Edmondson <dme@dme.org> writes:\r
+>\r
+>> On Fri, Oct 24 2014, Eric Abrahamsen wrote:\r
+>>> David Belohrad <david@belohrad.ch> writes:\r
+>>>\r
+>>>> Dear All,\r
+>>>>\r
+>>>> i'm using org. And I'm using notmuch (that's why I address both mailing\r
+>>>> lists). Now, writing an email in everyday bussiness requires a\r
+>>>> non-significant time of your workhours. So I'd like to have this event\r
+>>>> in my org agenda. So any time I send some email with a given subject,\r
+>>>> I'd like to 'automatically' entry the information about it into\r
+>>>> e.g. sentmails.org in form of a diary entry, with appropriate tag.\r
+>>>\r
+>>> I do something like this in Gnorb, which I'd recommend you use except\r
+>>> it's mostly Gnus specific.\r
+>>>\r
+>>> I do it in two parts, but you could do it in one. Basically I add a\r
+>>> function to the `message-header-hook' (which ensures that all the\r
+>>> message headers have been generated properly).\r
+>>\r
+>> Does `message-generate-headers-first' not do what you want for this\r
+>> specific part?\r
+>\r
+> Yeah, I think I looked at that previously. But this thing is going in a\r
+> hook anyway, might as well use the hook that *doesn't* require me to\r
+> call that function explicitly.\r
+>\r
+>>> Obviously the downside is that, without a "Gcc:" header, org can't\r
+>>> actually make a real link to the message. It doesn't know where it's\r
+>>> going to be. However if you know that all your sent messages can be\r
+>>> reached with a link that looks like "notmuch:id#Message-id", then you\r
+>>> can make that yourself in your org capture template with something like\r
+>>\r
+>> As you suggest, know the message-id should be good enough to generate a\r
+>> notmuch link, though you may have to wait for the notmuch index to be\r
+>> updated for the link to be valid.\r
+>\r
+> Yup, I've got the same issue with nnimap -- you have to wait for the\r
+> next sync to get access to the message. So far it hasn't been a problem,\r
+> though.\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r