|
| From: | Sebastian Rose |
| Subject: | Re: [Orgmode] Re: Sending org buffer as mail? |
| Date: | Thu, 16 Dec 2010 22:34:09 +0100 |
| User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Rainer M Krug <address@hidden> 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
| [Prev in Thread] | Current Thread | [Next in Thread] |