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:34:09 +0100 Message-ID: <87hbedpfla.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=60438 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTLTW-0001VG-Hq for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 16:34:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTLTV-0007GK-HS for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 16:34:58 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:33945 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PTLTV-0007GC-5Q for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 16:34:57 -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: > OK - I asked on the emacs help list, and got a response. I added the > followig to my emacs.org: > > * 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 I finally added an `(if (org-mode-p)' for my local usage: (add-hook 'message-mode-hook (lambda () (let (text) (with-current-buffer (other-buffer) (when (region-active-p) (setq text (if (org-mode-p) (org-export-region-as-ascii (region-beginning) (region-end) t 'string) (buffer-substring (region-beginning) (region-end)))))) (when text (end-of-buffer) (insert text))))) Best wishes Sebastian