Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 9F486431FAF for ; Fri, 24 May 2013 04:58:27 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X1QXs-vEzRGQ for ; Fri, 24 May 2013 04:58:18 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 76CB9431FAE for ; Fri, 24 May 2013 04:58:18 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 85F7B1002C3; Fri, 24 May 2013 14:58:12 +0300 (EEST) From: Tomi Ollila To: David Bremner , David Belohrad , notmuch Subject: Re: converting notmuch email to 'TODO' entry in org-mode In-Reply-To: <87li74obe9.fsf@zancas.localnet> References: <87li74obe9.fsf@zancas.localnet> User-Agent: Notmuch/0.15.2+115~g12cf6af (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2013 11:58:27 -0000 On Fri, May 24 2013, David Bremner wrote: > David Belohrad 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)))))