emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: Sending org buffer as mail?


From: Sebastian Rose
Subject: Re: [Orgmode] Re: Sending org buffer as mail?
Date: Thu, 16 Dec 2010 22:27:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Rainer M Krug <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]