From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Rose Subject: Re: Re: Sending org buffer as mail? Date: Thu, 16 Dec 2010 22:27:41 +0100 Message-ID: <87wrn9pfw2.fsf@gmx.de> References: <4D09C7F2.8020806@gmail.com> <87sjxy168c.fsf@gmail.com> <4D09D3BB.3020508@gmail.com> <87aak60zpd.fsf@gmail.com> <4D09ECCB.5000407@gmail.com> <4D0A0859.2040809@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=42533 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTLNK-0007w2-2j for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 16:28:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTLNI-0006Gq-Vi for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 16:28:33 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:54140 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PTLNI-0006GM-Ga for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 16:28:32 -0500 In-Reply-To: <4D0A0859.2040809@gmail.com> (Rainer M. Krug's message of "Thu, 16 Dec 2010 13:38:49 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rainer M Krug Cc: Oscar Carlsson , Jeff Horn , emacs-orgmode@gnu.org Rainer M Krug writes: > * Add message hook to include selected text as body > Thanks to Deniz Dogan > #+begin_src emacs-lisp > (add-hook 'message-mode-hook > (lambda () > (let (text) > (with-current-buffer (other-buffer) > (when (region-active-p) > (setq text > (buffer-substring (region-beginning) > (region-end))))) > (when text > (end-of-buffer) > (insert text))))) > #+end_src > > This is doing exactly as expected. How about inserting as ascii (just change the `(setq text...' lines)? (add-hook 'message-mode-hook (lambda () (let (text) (with-current-buffer (other-buffer) (when (region-active-p) (setq text (org-export-region-as-ascii (region-beginning) (region-end) t 'string)))) (when text (end-of-buffer) (insert text))))) This inserts the ascii export. Thanks for sharing :) Sebastian