From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oscar Carlsson Subject: Re: Re: Sending org buffer as mail? Date: Thu, 16 Dec 2010 14:49:31 +0100 Message-ID: <8739px25g4.fsf@gmail.com> 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; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=53428 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTEDD-0006dc-TG for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 08:49:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTED8-0003T4-PG for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 08:49:36 -0500 Received: from mail-fx0-f48.google.com ([209.85.161.48]:47758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PTED8-0003Sx-JP for emacs-orgmode@gnu.org; Thu, 16 Dec 2010 08:49:34 -0500 Received: by fxm2 with SMTP id 2so3140245fxm.35 for ; Thu, 16 Dec 2010 05:49:33 -0800 (PST) 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: Jeff Horn , emacs-orgmode@gnu.org Rainer M Krug writes: > On 12/16/2010 11:41 AM, Rainer M Krug wrote: >> On 12/16/2010 11:38 AM, Oscar Carlsson wrote: >>> Rainer M Krug writes: >> >>>> On 12/16/2010 09:25 AM, Jeff Horn wrote: >>>>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson >>>>> wrote: >>>>>> And then, I can send a org-file by attaching it to a mail in Emacs. Try >>>>>> C-x m to start a new mail buffer, attach with C-c C-a and send with C-c >>>>>> C-c. >>>> >>>> Sounds very interesting - I'll try it out. >>>> >>>> C-x m looks great - I am sure I am going to use it a lot. And gmail is >>>> exactly what I want to use it for. >>>> >>>>> >>>>> Does this attach the buffer or read it into the message? I thought the >>>>> OP wanted to read-in a buffer. >>>> >>>> Yes - that was effectively what I am looking for: the possiblility to >>>> write my email in org mode and send the buffer content as the email text. >>>> >>>> Dream: Specify subject, to, cc, bcc (probably even attachments) as >>>> properties, press a key and the org file is send to the addresses. >>>> >>>> Rainer >>>> >>>>> There should be a built-in function for >>>>> that, but I've never used it. >>>>> >> >>> In my answer above, you'd have to include the file as an attachment, or >>> insert the text into the mail (either with M-x insert-file or >>> copy/paste), it would have been better if compose-mail would have >>> inserted any marked text or such, but I don't know how to code such >>> functionality :-( >> >> Thanks Oscar - I think I can live with it at the moment. >> >> But to insert the marked text in the email body sounds a lot like emacs... > > 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 > > This is doing exactly as expected. Oh, I think that can be very handy in the long run. Thanks for sharing the snippet! Oscar