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

Tomi Ollila tomi.ollila at iki.fi
Fri May 24 04:58:12 PDT 2013


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

> David Belohrad <david at 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)))))


More information about the notmuch mailing list