Re: converting notmuch email to 'TODO' entry in org-mode

Subject: Re: converting notmuch email to 'TODO' entry in org-mode

Date: Fri, 24 May 2013 14:58:12 +0300

To: David Bremner, David Belohrad, notmuch

Cc:

From: Tomi Ollila


On Fri, May 24 2013, David Bremner <david@tethera.net> wrote:

> David Belohrad <david@belohrad.ch> writes:
>>
>> is there any way how to get 'current email' (not current thread)
>> contents into kill ring so I could write a small script to paste it into
>> org-mode template?
>
> Here is what I came up with by canibalizing existing functions. 
> Probably there is a more elegant way to do this.
>
> (defun notmuch-show-stash-body ()
>   (interactive)
>   (let ((all (buffer-substring (notmuch-show-message-top)
> 		     (notmuch-show-message-bottom))))

(copy-region-as-kill (notmuch-show-message-top) (notmuch-show-message-bottom)) ?

Sorry didn't do any experiments whether this approach works (and thought
whether any save-excursions. etc are needed (or not!))

Anyway, this was easy to come by after David's example withouth much
thinking :D

Tomi



>     (with-temp-buffer
>       (insert all)
>       ;; Remove the original header.
>       (goto-char (point-min))
>       (re-search-forward "^$" (point-max) nil)
>       (delete-region (point-min) (point))
>       (notmuch-common-do-stash
>        (buffer-string)))))

Thread: