Rainer M Krug <r.m.k...@gmail.com> 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

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to