emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Sending org buffer as mail?
@ 2010-12-16  8:04 Rainer M Krug
  2010-12-16  8:17 ` Oscar Carlsson
  0 siblings, 1 reply; 38+ messages in thread
From: Rainer M Krug @ 2010-12-16  8:04 UTC (permalink / raw)
  To: Emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

- From time to time, I would like to mail an .org buffer. At the moment, I
copy it into thunderbird and mail it - this is quite awkward.

I assume, there must be a better way of doing this from within emacs?.

I do not intend to switch to gnus or similar for reading my email, I
just want to be able to send, from time to time, an .org buffer as an email

Cheers,

Rainer

- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0Jx/IACgkQoYgNqgF2egpTCwCeK6UqllAlqUdXYOe/geP6CDzT
9ZQAnRvUhOMP0Qo/HSkhxx5NtsSCzgQn
=Ugi2
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Sending org buffer as mail?
  2010-12-16  8:04 Sending org buffer as mail? Rainer M Krug
@ 2010-12-16  8:17 ` Oscar Carlsson
  2010-12-16  8:25   ` Jeff Horn
  0 siblings, 1 reply; 38+ messages in thread
From: Oscar Carlsson @ 2010-12-16  8:17 UTC (permalink / raw)
  To: emacs-orgmode

Rainer M Krug <r.m.krug@gmail.com> writes:

> Hi
>
> From time to time, I would like to mail an .org buffer. At the moment, I
> copy it into thunderbird and mail it - this is quite awkward.
>
> I assume, there must be a better way of doing this from within emacs?.
>
> I do not intend to switch to gnus or similar for reading my email, I
> just want to be able to send, from time to time, an .org buffer as an email
>
> Cheers,
>
> Rainer

You don't have to switch to GNUS in order to do it, but you might have
to configure Emacs's built in smtp-support. This is how I do it:

#+BEGIN_SRC lisp
(setq message-send-mail-function 'smtpmail-send-it
      smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
      smtpmail-auth-credentials "~/.authinfo"
      smtpmail-default-smtp-server "smtp.gmail.com"
      smtpmail-smtp-server "smtp.gmail.com"
      smtpmail-smtp-service 587)
#+END_SRC

This is obviously for GMail. In my ~/.authinfo, I input the following:

#+BEGIN_SRC
machine smtp.gmail.com login user.name@gmail.com password p4ssw0rd
#+END_SRC

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. 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16  8:17 ` Oscar Carlsson
@ 2010-12-16  8:25   ` Jeff Horn
  2010-12-16  8:54     ` Rainer M Krug
  2010-12-16 10:37     ` Oscar Carlsson
  0 siblings, 2 replies; 38+ messages in thread
From: Jeff Horn @ 2010-12-16  8:25 UTC (permalink / raw)
  To: Oscar Carlsson; +Cc: emacs-orgmode

On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
<oscar.carlsson@gmail.com> 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.

Does this attach the buffer or read it into the message? I thought the
OP wanted to read-in a buffer. There should be a built-in function for
that, but I've never used it.

-- 
Jeffrey Horn
Graduate Lecturer and PhD Student in Economics
George Mason University

(704) 271-4797
jhorn@gmu.edu
jrhorn424@gmail.com

http://www.failuretorefrain.com/jeff/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16  8:25   ` Jeff Horn
@ 2010-12-16  8:54     ` Rainer M Krug
  2010-12-16 10:38       ` Oscar Carlsson
  2010-12-17  1:06       ` Matt Lundin
  2010-12-16 10:37     ` Oscar Carlsson
  1 sibling, 2 replies; 38+ messages in thread
From: Rainer M Krug @ 2010-12-16  8:54 UTC (permalink / raw)
  To: Jeff Horn; +Cc: Oscar Carlsson, emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/16/2010 09:25 AM, Jeff Horn wrote:
> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
> <oscar.carlsson@gmail.com> 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.
> 


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0J07sACgkQoYgNqgF2egrdpACfQkvt6rkmqyESt2r+wOvdq1hn
fCsAn0ReY6hNGtxnKP1lZUTXdAY/ev7L
=Z0gh
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16  8:25   ` Jeff Horn
  2010-12-16  8:54     ` Rainer M Krug
@ 2010-12-16 10:37     ` Oscar Carlsson
  2010-12-16 13:22       ` Eric Schulte
  2010-12-16 18:29       ` Jeff Horn
  1 sibling, 2 replies; 38+ messages in thread
From: Oscar Carlsson @ 2010-12-16 10:37 UTC (permalink / raw)
  To: Jeff Horn; +Cc: emacs-orgmode

Jeff Horn <jrhorn424@gmail.com> writes:

> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
> <oscar.carlsson@gmail.com> 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.
>
> Does this attach the buffer or read it into the message? I thought the
> OP wanted to read-in a buffer. There should be a built-in function for
> that, but I've never used it.

It would attach the file. But inserting the file would be trivial: =M-x
insert-file=

But I have to admit that's not optimal - it would be better have a macro
(or such) that did it for you. Or properties in the org-file in
question. Or tell compose-mail that it should include marked text.


Oscar

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16  8:54     ` Rainer M Krug
@ 2010-12-16 10:38       ` Oscar Carlsson
  2010-12-16 10:41         ` Rainer M Krug
  2010-12-17  1:06       ` Matt Lundin
  1 sibling, 1 reply; 38+ messages in thread
From: Oscar Carlsson @ 2010-12-16 10:38 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: Jeff Horn, emacs-orgmode

Rainer M Krug <r.m.krug@gmail.com> writes:

> On 12/16/2010 09:25 AM, Jeff Horn wrote:
>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>> <oscar.carlsson@gmail.com> 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 :-(


Oscar

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16 10:38       ` Oscar Carlsson
@ 2010-12-16 10:41         ` Rainer M Krug
  2010-12-16 12:38           ` Rainer M Krug
  0 siblings, 1 reply; 38+ messages in thread
From: Rainer M Krug @ 2010-12-16 10:41 UTC (permalink / raw)
  To: Oscar Carlsson; +Cc: Jeff Horn, emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/16/2010 11:38 AM, Oscar Carlsson wrote:
> Rainer M Krug <r.m.krug@gmail.com> writes:
> 
>> On 12/16/2010 09:25 AM, Jeff Horn wrote:
>>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>>> <oscar.carlsson@gmail.com> 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...

Cheers,

Rainer
> 
> 
> Oscar


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEUEARECAAYFAk0J7MoACgkQoYgNqgF2egoVSQCeM6Hlm6FBRKzsVARZlovJsS2l
Z8YAljq2RvUkqS+AVf4hMYbEsKfkBbM=
=L9Cf
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16 10:41         ` Rainer M Krug
@ 2010-12-16 12:38           ` Rainer M Krug
  2010-12-16 13:49             ` Oscar Carlsson
                               ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Rainer M Krug @ 2010-12-16 12:38 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: Oscar Carlsson, Jeff Horn, emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/16/2010 11:41 AM, Rainer M Krug wrote:
> On 12/16/2010 11:38 AM, Oscar Carlsson wrote:
>> Rainer M Krug <r.m.krug@gmail.com> writes:
> 
>>> On 12/16/2010 09:25 AM, Jeff Horn wrote:
>>>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>>>> <oscar.carlsson@gmail.com> 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.

Cheers,

Rainer


> 
> Cheers,
> 
> Rainer
> 
> 
>> Oscar
> 
> 

- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0KCFkACgkQoYgNqgF2egqX/ACdHmduO8M0C/QU6y9v9L/pTITj
BV4An1xAQJsRr+hd3Dx8UKWQ7d3+w7ps
=RDpz
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16 10:37     ` Oscar Carlsson
@ 2010-12-16 13:22       ` Eric Schulte
  2010-12-16 13:39         ` Rainer M Krug
  2010-12-16 14:45         ` Sébastien Vauban
  2010-12-16 18:29       ` Jeff Horn
  1 sibling, 2 replies; 38+ messages in thread
From: Eric Schulte @ 2010-12-16 13:22 UTC (permalink / raw)
  To: Oscar Carlsson; +Cc: Jeff Horn, emacs-orgmode

Please look at org-mime in the contrib directory.  It is designed for
this exact need.  Calling `org-mime-org-buffer-htmlize' from within an
Org-mode document will export the document to html, and then place the
html into a mail buffer with appropriate mime configuration, ensuring
things like linked images are handled appropriately.  See the worg page
for more information (follow gnus instructions for simple mail use)
http://orgmode.org/worg/org-contrib/org-mime.php

Hope this helps -- Eric

Oscar Carlsson <oscar.carlsson@gmail.com> writes:

> Jeff Horn <jrhorn424@gmail.com> writes:
>
>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>> <oscar.carlsson@gmail.com> 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.
>>
>> Does this attach the buffer or read it into the message? I thought the
>> OP wanted to read-in a buffer. There should be a built-in function for
>> that, but I've never used it.
>
> It would attach the file. But inserting the file would be trivial: =M-x
> insert-file=
>
> But I have to admit that's not optimal - it would be better have a macro
> (or such) that did it for you. Or properties in the org-file in
> question. Or tell compose-mail that it should include marked text.
>
>
> Oscar
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16 13:22       ` Eric Schulte
@ 2010-12-16 13:39         ` Rainer M Krug
  2010-12-16 14:45         ` Sébastien Vauban
  1 sibling, 0 replies; 38+ messages in thread
From: Rainer M Krug @ 2010-12-16 13:39 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Oscar Carlsson, Jeff Horn, emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/16/2010 02:22 PM, Eric Schulte wrote:

Hi Eric

> Please look at org-mime in the contrib directory.  It is designed for
> this exact need.  Calling `org-mime-org-buffer-htmlize' from within an
> Org-mode document will export the document to html, and then place the
> html into a mail buffer with appropriate mime configuration, ensuring
> things like linked images are handled appropriately.  See the worg page
> for more information (follow gnus instructions for simple mail use)
> http://orgmode.org/worg/org-contrib/org-mime.php

Interesting - there is always something new in org-land.

But I was actually looking at not exporting the org file, but sending it
as text - so I am happy with what I have now.

Thanks a lot,

Rainer


> 
> Hope this helps -- Eric
> 
> Oscar Carlsson <oscar.carlsson@gmail.com> writes:
> 
>> Jeff Horn <jrhorn424@gmail.com> writes:
>>
>>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>>> <oscar.carlsson@gmail.com> 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.
>>>
>>> Does this attach the buffer or read it into the message? I thought the
>>> OP wanted to read-in a buffer. There should be a built-in function for
>>> that, but I've never used it.
>>
>> It would attach the file. But inserting the file would be trivial: =M-x
>> insert-file=
>>
>> But I have to admit that's not optimal - it would be better have a macro
>> (or such) that did it for you. Or properties in the org-file in
>> question. Or tell compose-mail that it should include marked text.
>>
>>
>> Oscar
>>
>> _______________________________________________
>> 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
> 
> _______________________________________________
> 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


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0KFpwACgkQoYgNqgF2ego/EgCdEPFql4mVoc2Z6V8xNt9quUdY
nfcAn2+WFS7A++f0G1yM/MybZYM1Qit+
=BzER
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16 12:38           ` Rainer M Krug
@ 2010-12-16 13:49             ` Oscar Carlsson
  2010-12-16 21:27             ` Sebastian Rose
  2010-12-16 21:34             ` Sebastian Rose
  2 siblings, 0 replies; 38+ messages in thread
From: Oscar Carlsson @ 2010-12-16 13:49 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: Jeff Horn, emacs-orgmode

Rainer M Krug <r.m.krug@gmail.com> 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 <r.m.krug@gmail.com> writes:
>> 
>>>> On 12/16/2010 09:25 AM, Jeff Horn wrote:
>>>>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>>>>> <oscar.carlsson@gmail.com> 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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Sending org buffer as mail?
  2010-12-16 13:22       ` Eric Schulte
  2010-12-16 13:39         ` Rainer M Krug
@ 2010-12-16 14:45         ` Sébastien Vauban
  2010-12-16 14:56           ` Eric Schulte
  1 sibling, 1 reply; 38+ messages in thread
From: Sébastien Vauban @ 2010-12-16 14:45 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

"Eric Schulte" wrote:
> Please look at org-mime in the contrib directory.  It is designed for
> this exact need.  Calling `org-mime-org-buffer-htmlize' from within an
> Org-mode document will export the document to html, and then place the
> html into a mail buffer with appropriate mime configuration, ensuring
> things like linked images are handled appropriately.  See the worg page
> for more information (follow gnus instructions for simple mail use)
> http://orgmode.org/worg/org-contrib/org-mime.php

Would it be possible to send the headline as text in Gnus' message-mode,
keeping the same functionality (mailto, etc.)?

Best regards,
  Seb

-- 
Sébastien Vauban


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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16 14:45         ` Sébastien Vauban
@ 2010-12-16 14:56           ` Eric Schulte
  2010-12-16 16:19             ` Sébastien Vauban
  0 siblings, 1 reply; 38+ messages in thread
From: Eric Schulte @ 2010-12-16 14:56 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:

> Hi Eric,
>
> "Eric Schulte" wrote:
>> Please look at org-mime in the contrib directory.  It is designed for
>> this exact need.  Calling `org-mime-org-buffer-htmlize' from within an
>> Org-mode document will export the document to html, and then place the
>> html into a mail buffer with appropriate mime configuration, ensuring
>> things like linked images are handled appropriately.  See the worg page
>> for more information (follow gnus instructions for simple mail use)
>> http://orgmode.org/worg/org-contrib/org-mime.php
>
> Would it be possible to send the headline as text in Gnus' message-mode,
> keeping the same functionality (mailto, etc.)?
>

I don't understand what you mean.  Do you mean to set the title of an
Org-mode file as the subject of an email?

Thanks -- Eric

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Sending org buffer as mail?
  2010-12-16 14:56           ` Eric Schulte
@ 2010-12-16 16:19             ` Sébastien Vauban
  2010-12-16 18:20               ` Eric Schulte
  0 siblings, 1 reply; 38+ messages in thread
From: Sébastien Vauban @ 2010-12-16 16:19 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Eric,

"Eric Schulte" wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> "Eric Schulte" wrote:
>>> Please look at org-mime in the contrib directory.  It is designed for
>>> this exact need.  Calling `org-mime-org-buffer-htmlize' from within an
>>> Org-mode document will export the document to html, and then place the
>>> html into a mail buffer with appropriate mime configuration, ensuring
>>> things like linked images are handled appropriately.  See the worg page
>>> for more information (follow gnus instructions for simple mail use)
>>> http://orgmode.org/worg/org-contrib/org-mime.php
>>
>> Would it be possible to send the headline as text in Gnus' message-mode,
>> keeping the same functionality (mailto, etc.)?
>
> I don't understand what you mean.  Do you mean to set the title of an
> Org-mode file as the subject of an email?

Yes, exactly. Sending a subtree in text, with its headline used as =Subject=.

And maybe setting accordingly the =To=, =Cc=, =BCc=, if such are in the
PROPERTY drawer?

Not that important, but something that could be used quite often...

Best regards,
  Seb

-- 
Sébastien Vauban


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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16 16:19             ` Sébastien Vauban
@ 2010-12-16 18:20               ` Eric Schulte
  0 siblings, 0 replies; 38+ messages in thread
From: Eric Schulte @ 2010-12-16 18:20 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Hi,

This is not implemented yet, but shouldn't be hard to implement starting
with the current code base.  I encourage anyone who is interested to
take a look at org-mime and try their hand at improving it.  I'm
strapped for time at the moment and probably wont have time to take a
look at it, but I do plan to make improvements in the long term.

Best -- Eric

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:

> Eric,
>
> "Eric Schulte" wrote:
>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
>>> "Eric Schulte" wrote:
>>>> Please look at org-mime in the contrib directory.  It is designed for
>>>> this exact need.  Calling `org-mime-org-buffer-htmlize' from within an
>>>> Org-mode document will export the document to html, and then place the
>>>> html into a mail buffer with appropriate mime configuration, ensuring
>>>> things like linked images are handled appropriately.  See the worg page
>>>> for more information (follow gnus instructions for simple mail use)
>>>> http://orgmode.org/worg/org-contrib/org-mime.php
>>>
>>> Would it be possible to send the headline as text in Gnus' message-mode,
>>> keeping the same functionality (mailto, etc.)?
>>
>> I don't understand what you mean.  Do you mean to set the title of an
>> Org-mode file as the subject of an email?
>
> Yes, exactly. Sending a subtree in text, with its headline used as =Subject=.
>
> And maybe setting accordingly the =To=, =Cc=, =BCc=, if such are in the
> PROPERTY drawer?
>
> Not that important, but something that could be used quite often...
>
> Best regards,
>   Seb

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16 10:37     ` Oscar Carlsson
  2010-12-16 13:22       ` Eric Schulte
@ 2010-12-16 18:29       ` Jeff Horn
  1 sibling, 0 replies; 38+ messages in thread
From: Jeff Horn @ 2010-12-16 18:29 UTC (permalink / raw)
  To: Oscar Carlsson; +Cc: emacs-orgmode

On Thu, Dec 16, 2010 at 5:37 AM, Oscar Carlsson
<oscar.carlsson@gmail.com> wrote:
> Jeff Horn <jrhorn424@gmail.com> writes:
>
>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>> <oscar.carlsson@gmail.com> 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.
>>
>> Does this attach the buffer or read it into the message? I thought the
>> OP wanted to read-in a buffer. There should be a built-in function for
>> that, but I've never used it.
>
> It would attach the file. But inserting the file would be trivial: =M-x
> insert-file=
>
> But I have to admit that's not optimal - it would be better have a macro
> (or such) that did it for you. Or properties in the org-file in
> question. Or tell compose-mail that it should include marked text.

I could see myself using properties for this.

-- 
Jeffrey Horn
Graduate Lecturer and PhD Student in Economics
George Mason University

(704) 271-4797
jhorn@gmu.edu
jrhorn424@gmail.com

http://www.failuretorefrain.com/jeff/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16 12:38           ` Rainer M Krug
  2010-12-16 13:49             ` Oscar Carlsson
@ 2010-12-16 21:27             ` Sebastian Rose
  2010-12-16 21:34             ` Sebastian Rose
  2 siblings, 0 replies; 38+ messages in thread
From: Sebastian Rose @ 2010-12-16 21:27 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: Oscar Carlsson, Jeff Horn, emacs-orgmode

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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-16 12:38           ` Rainer M Krug
  2010-12-16 13:49             ` Oscar Carlsson
  2010-12-16 21:27             ` Sebastian Rose
@ 2010-12-16 21:34             ` Sebastian Rose
  2 siblings, 0 replies; 38+ messages in thread
From: Sebastian Rose @ 2010-12-16 21:34 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: Oscar Carlsson, Jeff Horn, emacs-orgmode

Rainer M Krug <r.m.krug@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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Sending org buffer as mail?
  2010-12-16  8:54     ` Rainer M Krug
  2010-12-16 10:38       ` Oscar Carlsson
@ 2010-12-17  1:06       ` Matt Lundin
  2010-12-17  1:27         ` Eric Schulte
  1 sibling, 1 reply; 38+ messages in thread
From: Matt Lundin @ 2010-12-17  1:06 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: Oscar Carlsson, Jeff Horn, emacs-orgmode

Rainer M Krug <r.m.krug@gmail.com> writes:

> On 12/16/2010 09:25 AM, Jeff Horn wrote:
>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>> <oscar.carlsson@gmail.com> 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.

I too have been looking for this functionality for a while, so here's a
quick solution. When called on an Org-mode subtree, the following
function makes the headline the subject, exports the subtree to ascii,
and uses properties ("MAIL_TO", "MAIL_CC", "MAIL_BCC") to specify the
addressees:

--8<---------------cut here---------------start------------->8---
(defun my-org-subtree-to-message ()
  (interactive)
  (unless (eq major-mode 'org-mode)
    (error "Not in org buffer"))
  (let ((subject (nth 4 (org-heading-components)))
	(to (org-entry-get nil "MAIL_TO"))
	(cc (org-entry-get nil "MAIL_CC"))
	(bcc (org-entry-get nil "MAIL_BCC"))
	text)
    (save-excursion 
      (org-mark-subtree)
      ;; don't include title in body
      (forward-line)
      (setq text (org-export-region-as-ascii (point)
					     (mark) t 'string)))
    (message-mail to subject `((cc . ,cc) (bcc . ,bcc)) nil)
    (when text 
      (save-excursion
	(goto-char (point-max))
	(insert text)))))
--8<---------------cut here---------------end--------------->8---

With this function, you can compose emails like this:

--8<---------------cut here---------------start------------->8---
* My obsequious missive
  :PROPERTIES:
  :MAIL_TO:  highly_esteemed@gentlemen.net
  :MAIL_BCC:  peasants_united@plebeians.org
  :END:
My most noble sirs,

I thank you for gracing this world with your beauteous presence.

Humbly yours,
An Org-mode user
--8<---------------cut here---------------end--------------->8---

Best,
Matt

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-17  1:06       ` Matt Lundin
@ 2010-12-17  1:27         ` Eric Schulte
  2010-12-17  6:48           ` Eric Schulte
                             ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Eric Schulte @ 2010-12-17  1:27 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Oscar Carlsson, Jeff Horn, emacs-orgmode, Rainer M Krug

Hi Matt,

This looks great, how would you feel about trying to fold this into
org-mime, or would you mind if I did so.  I've already mimicked your
function to set subjects of outgoing emails to match the title of the
org-mode buffer.  I think that generalizing the org-mime functions to
operate over either subtrees or whole files, and to output either html
or plain text should cover all use cases with maximal code re-use.

Thanks for sharing this function.

Cheers -- Eric

Matt Lundin <mdl@imapmail.org> writes:

> Rainer M Krug <r.m.krug@gmail.com> writes:
>
>> On 12/16/2010 09:25 AM, Jeff Horn wrote:
>>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>>> <oscar.carlsson@gmail.com> 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.
>
> I too have been looking for this functionality for a while, so here's a
> quick solution. When called on an Org-mode subtree, the following
> function makes the headline the subject, exports the subtree to ascii,
> and uses properties ("MAIL_TO", "MAIL_CC", "MAIL_BCC") to specify the
> addressees:
>
> (defun my-org-subtree-to-message ()
>   (interactive)
>   (unless (eq major-mode 'org-mode)
>     (error "Not in org buffer"))
>   (let ((subject (nth 4 (org-heading-components)))
> 	(to (org-entry-get nil "MAIL_TO"))
> 	(cc (org-entry-get nil "MAIL_CC"))
> 	(bcc (org-entry-get nil "MAIL_BCC"))
> 	text)
>     (save-excursion 
>       (org-mark-subtree)
>       ;; don't include title in body
>       (forward-line)
>       (setq text (org-export-region-as-ascii (point)
> 					     (mark) t 'string)))
>     (message-mail to subject `((cc . ,cc) (bcc . ,bcc)) nil)
>     (when text 
>       (save-excursion
> 	(goto-char (point-max))
> 	(insert text)))))
>
> With this function, you can compose emails like this:
>
> * My obsequious missive
>   :PROPERTIES:
>   :MAIL_TO:  highly_esteemed@gentlemen.net
>   :MAIL_BCC:  peasants_united@plebeians.org
>   :END:
> My most noble sirs,
>
> I thank you for gracing this world with your beauteous presence.
>
> Humbly yours,
> An Org-mode user
>
> Best,
> Matt
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-17  1:27         ` Eric Schulte
@ 2010-12-17  6:48           ` Eric Schulte
  2010-12-17  8:57             ` Rainer M Krug
  2010-12-17 11:54           ` Matt Lundin
  2010-12-17 14:47           ` Jean-Marie Gaillourdet
  2 siblings, 1 reply; 38+ messages in thread
From: Eric Schulte @ 2010-12-17  6:48 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Oscar Carlsson, Jeff Horn, emacs-orgmode, Rainer M Krug

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

I'm attaching a new version of org-mime.el which incorporates Matt's
function below.  There are now two new functions, `org-mime-org-buffer'
and `org-mime-org-subtree' each of which takes a format argument
specifying the format of the final email, one of 'org, 'ascii, or 'html.

So, for example the following will export the current subtree as ascii
into an email body, using the MAIL_TO, MAIL_CC, and MAIL_BCC properties
to build the email headers, and the headline to set the subject (both
directly from Matt's function below).

(defun org-mime-subtree-to-ascii ()
  (interactive)
  (org-mime-org-subtree 'ascii))

Does this new version of org-mime look like it should be committed?  Are
there any features or changes that should be considered first?

Cheers -- Eric


[-- Attachment #2: org-mime.el --]
[-- Type: application/emacs-lisp, Size: 10447 bytes --]

[-- Attachment #3: Type: text/plain, Size: 3115 bytes --]


"Eric Schulte" <schulte.eric@gmail.com> writes:

> Hi Matt,
>
> This looks great, how would you feel about trying to fold this into
> org-mime, or would you mind if I did so.  I've already mimicked your
> function to set subjects of outgoing emails to match the title of the
> org-mode buffer.  I think that generalizing the org-mime functions to
> operate over either subtrees or whole files, and to output either html
> or plain text should cover all use cases with maximal code re-use.
>
> Thanks for sharing this function.
>
> Cheers -- Eric
>
> Matt Lundin <mdl@imapmail.org> writes:
>
>> Rainer M Krug <r.m.krug@gmail.com> writes:
>>
>>> On 12/16/2010 09:25 AM, Jeff Horn wrote:
>>>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>>>> <oscar.carlsson@gmail.com> 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.
>>
>> I too have been looking for this functionality for a while, so here's a
>> quick solution. When called on an Org-mode subtree, the following
>> function makes the headline the subject, exports the subtree to ascii,
>> and uses properties ("MAIL_TO", "MAIL_CC", "MAIL_BCC") to specify the
>> addressees:
>>
>> (defun my-org-subtree-to-message ()
>>   (interactive)
>>   (unless (eq major-mode 'org-mode)
>>     (error "Not in org buffer"))
>>   (let ((subject (nth 4 (org-heading-components)))
>> 	(to (org-entry-get nil "MAIL_TO"))
>> 	(cc (org-entry-get nil "MAIL_CC"))
>> 	(bcc (org-entry-get nil "MAIL_BCC"))
>> 	text)
>>     (save-excursion 
>>       (org-mark-subtree)
>>       ;; don't include title in body
>>       (forward-line)
>>       (setq text (org-export-region-as-ascii (point)
>> 					     (mark) t 'string)))
>>     (message-mail to subject `((cc . ,cc) (bcc . ,bcc)) nil)
>>     (when text 
>>       (save-excursion
>> 	(goto-char (point-max))
>> 	(insert text)))))
>>
>> With this function, you can compose emails like this:
>>
>> * My obsequious missive
>>   :PROPERTIES:
>>   :MAIL_TO:  highly_esteemed@gentlemen.net
>>   :MAIL_BCC:  peasants_united@plebeians.org
>>   :END:
>> My most noble sirs,
>>
>> I thank you for gracing this world with your beauteous presence.
>>
>> Humbly yours,
>> An Org-mode user
>>
>> Best,
>> Matt
>>
>> _______________________________________________
>> 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

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-17  6:48           ` Eric Schulte
@ 2010-12-17  8:57             ` Rainer M Krug
  2010-12-17 10:02               ` Eric Schulte
  0 siblings, 1 reply; 38+ messages in thread
From: Rainer M Krug @ 2010-12-17  8:57 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Oscar Carlsson, Matt Lundin, emacs-orgmode, Jeff Horn

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/17/2010 07:48 AM, Eric Schulte wrote:
Hi eric

> I'm attaching a new version of org-mime.el which incorporates Matt's
> function below.  There are now two new functions, `org-mime-org-buffer'
> and `org-mime-org-subtree' each of which takes a format argument
> specifying the format of the final email, one of 'org, 'ascii, or 'html.

This sounds perfect.

So now a *subtree* or *org buffer* can be send as
*org*, *ascii or *html*.

Right?

I just would like to suggest two more things:

1) to be able to mail the subtree or buffer as an attached pdf.

Thinking of it, this could also be used for the other formats which
result in one file, e.g. ascii, taskjuggle and I think all others except
of the html?

2) the format of the inline text (and the attached one?) could be
specified as a property, as a property - this would make sending the
email consistent.

And I must say, I really like the subtree option - now we just need a
function to import an email into org, and one could use an org file to
manage email conversations...

Cheers and thanks a lot - this sounds really good,

Rainer

> 
> So, for example the following will export the current subtree as ascii
> into an email body, using the MAIL_TO, MAIL_CC, and MAIL_BCC properties
> to build the email headers, and the headline to set the subject (both
> directly from Matt's function below).
> 
> (defun org-mime-subtree-to-ascii ()
>   (interactive)
>   (org-mime-org-subtree 'ascii))
> 
> Does this new version of org-mime look like it should be committed?  Are
> there any features or changes that should be considered first?
> 
> Cheers -- Eric
> 
> 
> 
> 
> 
> "Eric Schulte" <schulte.eric@gmail.com> writes:
> 
>> Hi Matt,
>>
>> This looks great, how would you feel about trying to fold this into
>> org-mime, or would you mind if I did so.  I've already mimicked your
>> function to set subjects of outgoing emails to match the title of the
>> org-mode buffer.  I think that generalizing the org-mime functions to
>> operate over either subtrees or whole files, and to output either html
>> or plain text should cover all use cases with maximal code re-use.
>>
>> Thanks for sharing this function.
>>
>> Cheers -- Eric
>>
>> Matt Lundin <mdl@imapmail.org> writes:
>>
>>> Rainer M Krug <r.m.krug@gmail.com> writes:
>>>
>>>> On 12/16/2010 09:25 AM, Jeff Horn wrote:
>>>>> On Thu, Dec 16, 2010 at 3:17 AM, Oscar Carlsson
>>>>> <oscar.carlsson@gmail.com> 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.
>>>
>>> I too have been looking for this functionality for a while, so here's a
>>> quick solution. When called on an Org-mode subtree, the following
>>> function makes the headline the subject, exports the subtree to ascii,
>>> and uses properties ("MAIL_TO", "MAIL_CC", "MAIL_BCC") to specify the
>>> addressees:
>>>
>>> (defun my-org-subtree-to-message ()
>>>   (interactive)
>>>   (unless (eq major-mode 'org-mode)
>>>     (error "Not in org buffer"))
>>>   (let ((subject (nth 4 (org-heading-components)))
>>> 	(to (org-entry-get nil "MAIL_TO"))
>>> 	(cc (org-entry-get nil "MAIL_CC"))
>>> 	(bcc (org-entry-get nil "MAIL_BCC"))
>>> 	text)
>>>     (save-excursion 
>>>       (org-mark-subtree)
>>>       ;; don't include title in body
>>>       (forward-line)
>>>       (setq text (org-export-region-as-ascii (point)
>>> 					     (mark) t 'string)))
>>>     (message-mail to subject `((cc . ,cc) (bcc . ,bcc)) nil)
>>>     (when text 
>>>       (save-excursion
>>> 	(goto-char (point-max))
>>> 	(insert text)))))
>>>
>>> With this function, you can compose emails like this:
>>>
>>> * My obsequious missive
>>>   :PROPERTIES:
>>>   :MAIL_TO:  highly_esteemed@gentlemen.net
>>>   :MAIL_BCC:  peasants_united@plebeians.org
>>>   :END:
>>> My most noble sirs,
>>>
>>> I thank you for gracing this world with your beauteous presence.
>>>
>>> Humbly yours,
>>> An Org-mode user
>>>
>>> Best,
>>> Matt
>>>
>>> _______________________________________________
>>> 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


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0LJf0ACgkQoYgNqgF2egqMhQCfRCdlivRA4Bm6FcW9zRR1tRT7
4IMAoIBfJI5QdVuOHz8RC0/mo5vupygJ
=rw33
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-17  8:57             ` Rainer M Krug
@ 2010-12-17 10:02               ` Eric Schulte
  0 siblings, 0 replies; 38+ messages in thread
From: Eric Schulte @ 2010-12-17 10:02 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: Oscar Carlsson, Matt Lundin, emacs-orgmode, Jeff Horn

[-- Attachment #1: Type: text/plain, Size: 1528 bytes --]

Rainer M Krug <r.m.krug@gmail.com> writes:

> On 12/17/2010 07:48 AM, Eric Schulte wrote:
> Hi eric
>
>> I'm attaching a new version of org-mime.el which incorporates Matt's
>> function below.  There are now two new functions, `org-mime-org-buffer'
>> and `org-mime-org-subtree' each of which takes a format argument
>> specifying the format of the final email, one of 'org, 'ascii, or 'html.
>
> This sounds perfect.
>
> So now a *subtree* or *org buffer* can be send as
> *org*, *ascii or *html*.
>
> Right?
>

Correct, all one need do is to write an interactive wrapping function
similar to the example in my previous email.  Note: In the version
attached to this email the functions are renamed to
`org-mime-send-buffer' and `org-mime-send-subtree'.

>
> I just would like to suggest two more things:
>
> 1) to be able to mail the subtree or buffer as an attached pdf.
>
> Thinking of it, this could also be used for the other formats which
> result in one file, e.g. ascii, taskjuggle and I think all others except
> of the html?
>

Sounds like a good idea, this shouldn't be overly hard to implement
using the existing attachment features of org-mime.

>
> 2) the format of the inline text (and the attached one?) could be
> specified as a property, as a property - this would make sending the
> email consistent.
>

I'm attaching another version of org-mime which provides the
org-mime-subtree interactive command which uses the MAIL_FMT property to
determine the format of the mail message to populate.

Thanks -- Eric


[-- Attachment #2: org-mime.el --]
[-- Type: application/emacs-lisp, Size: 10446 bytes --]

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-17  1:27         ` Eric Schulte
  2010-12-17  6:48           ` Eric Schulte
@ 2010-12-17 11:54           ` Matt Lundin
  2010-12-17 21:25             ` Eric Schulte
  2010-12-17 14:47           ` Jean-Marie Gaillourdet
  2 siblings, 1 reply; 38+ messages in thread
From: Matt Lundin @ 2010-12-17 11:54 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Oscar Carlsson, Jeff Horn, emacs-orgmode, Rainer M Krug

"Eric Schulte" <schulte.eric@gmail.com> writes:

> This looks great, how would you feel about trying to fold this into
> org-mime, or would you mind if I did so.  

I don't mind at all. Thanks for integrating it into org-mime.el!

Now if only I could figure out how bbdb address completion works; then
we could hook it into org-property-allowed-value-functions. :)

Best,
Matt

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-17  1:27         ` Eric Schulte
  2010-12-17  6:48           ` Eric Schulte
  2010-12-17 11:54           ` Matt Lundin
@ 2010-12-17 14:47           ` Jean-Marie Gaillourdet
  2010-12-17 21:26             ` Eric Schulte
  2 siblings, 1 reply; 38+ messages in thread
From: Jean-Marie Gaillourdet @ 2010-12-17 14:47 UTC (permalink / raw)
  To: Eric Schulte
  Cc: Oscar Carlsson, Matt Lundin, emacs-orgmode, Jeff Horn,
	Rainer M Krug

Hi Eric,

"Eric Schulte" <schulte.eric@gmail.com> writes:

> Hi Matt,
>
> This looks great, how would you feel about trying to fold this into
> org-mime, or would you mind if I did so.  I've already mimicked your
> function to set subjects of outgoing emails to match the title of the
> org-mode buffer.  I think that generalizing the org-mime functions to
> operate over either subtrees or whole files, and to output either html
> or plain text should cover all use cases with maximal code re-use.

does it also support using ascii exports as text part and the html
export as html part in a multi part message?

Thanks for org-mime, I'll try it tomorrow.

Cheers,
Jean-Marie

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-17 11:54           ` Matt Lundin
@ 2010-12-17 21:25             ` Eric Schulte
  2010-12-19 12:21               ` Niels Giesen
  0 siblings, 1 reply; 38+ messages in thread
From: Eric Schulte @ 2010-12-17 21:25 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Oscar Carlsson, Jeff Horn, emacs-orgmode, Rainer M Krug

Thanks, I've just pushed up a new version of org-mime which makes use of
this function.

The two new externally visible functions are

`org-mime-org-buffer-htmlize' (so named for backwards compatability)
    which will export the current buffer or region to an html/org
    multipart email.

and

`org-mime-subtree' which exports the current subtree to an email using
    the heading, and the mail_to, mail_cc, mail_bcc and mail_fmt
    headings to construct the email headings for format the subtree

Thanks -- Eric

Matt Lundin <mdl@imapmail.org> writes:

> "Eric Schulte" <schulte.eric@gmail.com> writes:
>
>> This looks great, how would you feel about trying to fold this into
>> org-mime, or would you mind if I did so.  
>
> I don't mind at all. Thanks for integrating it into org-mime.el!
>
> Now if only I could figure out how bbdb address completion works; then
> we could hook it into org-property-allowed-value-functions. :)
>
> Best,
> Matt

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-17 14:47           ` Jean-Marie Gaillourdet
@ 2010-12-17 21:26             ` Eric Schulte
  2010-12-18 23:26               ` Ethan Ligon
  0 siblings, 1 reply; 38+ messages in thread
From: Eric Schulte @ 2010-12-17 21:26 UTC (permalink / raw)
  To: Jean-Marie Gaillourdet
  Cc: Oscar Carlsson, Matt Lundin, emacs-orgmode, Jeff Horn,
	Rainer M Krug

Jean-Marie Gaillourdet <jmg@gaillourdet.net> writes:

> Hi Eric,
>
> "Eric Schulte" <schulte.eric@gmail.com> writes:
>
>> Hi Matt,
>>
>> This looks great, how would you feel about trying to fold this into
>> org-mime, or would you mind if I did so.  I've already mimicked your
>> function to set subjects of outgoing emails to match the title of the
>> org-mode buffer.  I think that generalizing the org-mime functions to
>> operate over either subtrees or whole files, and to output either html
>> or plain text should cover all use cases with maximal code re-use.
>
> does it also support using ascii exports as text part and the html
> export as html part in a multi part message?
>

It does now.  In the version I just pushed up an html and ascii export
can be accomplished by setting the :MAIL_FMT: property to html-ascii, or
by calling either `org-mime-send-buffer' or `org-mime-send-subtree' with
'html-ascii as an argument.

Best -- Eric

>
> Thanks for org-mime, I'll try it tomorrow.
>
> Cheers,
> Jean-Marie

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Sending org buffer as mail?
  2010-12-17 21:26             ` Eric Schulte
@ 2010-12-18 23:26               ` Ethan Ligon
  2010-12-20  1:46                 ` Eric Schulte
  0 siblings, 1 reply; 38+ messages in thread
From: Ethan Ligon @ 2010-12-18 23:26 UTC (permalink / raw)
  To: emacs-orgmode

Eric Schulte <schulte.eric <at> gmail.com> writes:
> 
> Jean-Marie Gaillourdet <jmg <at> gaillourdet.net> writes:
> 
> > Hi Eric,
> >
> > "Eric Schulte" <schulte.eric <at> gmail.com> writes:
> >
> >> Hi Matt,
> >>
> >> This looks great, how would you feel about trying to fold this into
> >> org-mime, or would you mind if I did so.  I've already mimicked your
> >> function to set subjects of outgoing emails to match the title of the
> >> org-mode buffer.  I think that generalizing the org-mime functions to
> >> operate over either subtrees or whole files, and to output either html
> >> or plain text should cover all use cases with maximal code re-use.
> >
> > does it also support using ascii exports as text part and the html
> > export as html part in a multi part message?
> >
> 
> It does now.  In the version I just pushed up an html and ascii export
> can be accomplished by setting the :MAIL_FMT: property to html-ascii, or
> by calling either `org-mime-send-buffer' or `org-mime-send-subtree' with
> 'html-ascii as an argument.
> 

Eric-

This is just great; thanks!  

Two additional suggestions:

1. The subject line should be exported as ascii also, to avoid 
   funky orgmode markup messing things up (I often have links in my
   headlines, for example).

2. Could we get some indication that the subtree's been mailed?  I'm
   thinking of having org-mime-subtree set a property MAIL_SENT to a
   time stamp or perhaps to the message id.  

   This way, if we inspect the subtree later we'll know if and when
   it was actually sent.  A possible bonus if we use the message id:
   when we get to the point of getting replies *back* into the org
   file it'll be possible to thread things properly.

-Ethan

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-17 21:25             ` Eric Schulte
@ 2010-12-19 12:21               ` Niels Giesen
  2010-12-19 20:47                 ` Samuel Wales
  2010-12-19 23:39                 ` Eric Schulte
  0 siblings, 2 replies; 38+ messages in thread
From: Niels Giesen @ 2010-12-19 12:21 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 964 bytes --]

"Eric Schulte" <schulte.eric@gmail.com> writes:

> Thanks, I've just pushed up a new version of org-mime which makes use of
> this function.

[...]

Hi Eric,

I love the org-mime-subtree function! It makes writing good-looking
mails very easy.

Now for a proposal:

For ascii export used for mail, it would be cool if SRC and EXAMPLE
blocks be surrounded by "cut here" scissor lines. They look well in gnus
for example:

--8<---------------cut here---------------start------------->8---
code or example here
--8<---------------cut here---------------end--------------->8---

Maybe the best way to achieve this is to define a hook before the string
is sent to `org-export-string' with the FMT arg set to 'ascii, so that
people can define their own functions. For instance, there are also
people who prefer a block like

,----[ emacs-lisp ]
| source here
`----

What do you think?

Regards,

Niels.

-- 
http://pft.github.com/

[-- Attachment #1.2: Type: application/pgp-signature, Size: 196 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-19 12:21               ` Niels Giesen
@ 2010-12-19 20:47                 ` Samuel Wales
  2010-12-19 23:39                 ` Eric Schulte
  1 sibling, 0 replies; 38+ messages in thread
From: Samuel Wales @ 2010-12-19 20:47 UTC (permalink / raw)
  To: Niels Giesen; +Cc: emacs-orgmode

Hi Niels,

On 2010-12-19, Niels Giesen <niels.giesen@gmail.com> wrote:
> ,----[ emacs-lisp ]
> | source here
> `----

This is much harder to extract.  Even if most people are willing to
use and know rectangle commands, newcomers don't.

I once pointed this out on emacs-help, and one person responded by
writing a command that extracts the source.  So a newcomer would have
to know to look for that command, get it, extract it, evaluate it,
then extract the source he originally wanted to extract.  I think that
person didn't quite get the point.  :)

Samuel

-- 
Q: How many CDC "scientists" does it take to change a lightbulb?
A: "You only think it's dark." [CDC has denied a deadly serious
disease for 25 years]
==========
HIV-like virus: http://www.wpinstitute.org/xmrv/index.html -- PLEASE DONATE
===
I want to see the original (pre-hold) Lo et al. 2010 NIH/FDA/Harvard MLV paper.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-19 12:21               ` Niels Giesen
  2010-12-19 20:47                 ` Samuel Wales
@ 2010-12-19 23:39                 ` Eric Schulte
  2010-12-21 20:55                   ` Niels Giesen
  1 sibling, 1 reply; 38+ messages in thread
From: Eric Schulte @ 2010-12-19 23:39 UTC (permalink / raw)
  To: Niels Giesen; +Cc: emacs-orgmode

Niels Giesen <niels.giesen@gmail.com> writes:

> "Eric Schulte" <schulte.eric@gmail.com> writes:
>
>> Thanks, I've just pushed up a new version of org-mime which makes use of
>> this function.
>
> [...]
>
> Hi Eric,
>
> I love the org-mime-subtree function! It makes writing good-looking
> mails very easy.
>
> Now for a proposal:
>
> For ascii export used for mail, it would be cool if SRC and EXAMPLE
> blocks be surrounded by "cut here" scissor lines. They look well in gnus
> for example:
>

For even better looking code in gnus, I personally prefer to use org as
my export target (rather than ascii), and with "Org-mode code block
fontification" configuration from
http://eschulte.github.com/emacs-starter-kit/starter-kit-gnus.html
code blocks inside org-mode markup will be correctly fontified in gnus
messages.

>
> code or example here
>
> Maybe the best way to achieve this is to define a hook before the string
> is sent to `org-export-string' with the FMT arg set to 'ascii, so that
> people can define their own functions. For instance, there are also
> people who prefer a block like
>

good idea, I've just added a series of hooks to org-mime which will be
called in a temporary buffer holding the text to be exported, so you
could add a function here to add scissor lines around code blocks.  Like
Sam I would discourage the use of boxquotes for anything that users may
want to cut and paste.  For ascii use the `org-mime-pre-ascii-hook'.

If you come up with useful hooks it may be nice to share them on worg at
http://orgmode.org/worg/org-contrib/org-mime.php

>
> ,----[ emacs-lisp ]
> | source here
> `----
>
> What do you think?
>
> Regards,
>
> Niels.

Thanks for the suggestion -- Eric

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-18 23:26               ` Ethan Ligon
@ 2010-12-20  1:46                 ` Eric Schulte
  2010-12-20 10:20                   ` Sébastien Vauban
  0 siblings, 1 reply; 38+ messages in thread
From: Eric Schulte @ 2010-12-20  1:46 UTC (permalink / raw)
  To: Ethan Ligon; +Cc: emacs-orgmode

Ethan Ligon <ligon@are.berkeley.edu> writes:

> Eric Schulte <schulte.eric <at> gmail.com> writes:
>> 
>> Jean-Marie Gaillourdet <jmg <at> gaillourdet.net> writes:
>> 
>> > Hi Eric,
>> >
>> > "Eric Schulte" <schulte.eric <at> gmail.com> writes:
>> >
>> >> Hi Matt,
>> >>
>> >> This looks great, how would you feel about trying to fold this into
>> >> org-mime, or would you mind if I did so.  I've already mimicked your
>> >> function to set subjects of outgoing emails to match the title of the
>> >> org-mode buffer.  I think that generalizing the org-mime functions to
>> >> operate over either subtrees or whole files, and to output either html
>> >> or plain text should cover all use cases with maximal code re-use.
>> >
>> > does it also support using ascii exports as text part and the html
>> > export as html part in a multi part message?
>> >
>> 
>> It does now.  In the version I just pushed up an html and ascii export
>> can be accomplished by setting the :MAIL_FMT: property to html-ascii, or
>> by calling either `org-mime-send-buffer' or `org-mime-send-subtree' with
>> 'html-ascii as an argument.
>> 
>
> Eric-
>
> This is just great; thanks!  
>
> Two additional suggestions:
>
> 1. The subject line should be exported as ascii also, to avoid 
>    funky orgmode markup messing things up (I often have links in my
>    headlines, for example).
>

Unfortunately I don't know if any good/easy way to strip out these
emphasis markers.

>
> 2. Could we get some indication that the subtree's been mailed?  I'm
>    thinking of having org-mime-subtree set a property MAIL_SENT to a
>    time stamp or perhaps to the message id.  
>
>    This way, if we inspect the subtree later we'll know if and when
>    it was actually sent.  A possible bonus if we use the message id:
>    when we get to the point of getting replies *back* into the org
>    file it'll be possible to thread things properly.
>

I've added two hooks, `org-mime-send-subtree-hook' and
`org-mime-send-buffer-hook' which can be used to do this, for example
the following

#+begin_src emacs-lisp
  (add-hook 'org-mime-send-subtree-hook
            (lambda ()
              (org-entry-put (point) "mail_sent" (current-time-string))))
#+end_src

will add a mail_sent property with the current time when
org-mime-subtree is called.  The only downside here is that the property
is added before the email is sent, so choosing not to send the email
after reviewing it in the message buffer could result in a misleading
mail_sent property, in fact maybe mail_sent should be changed to
mail_composed.

Cheers -- Eric

>
> -Ethan
>
>
>
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Sending org buffer as mail?
  2010-12-20  1:46                 ` Eric Schulte
@ 2010-12-20 10:20                   ` Sébastien Vauban
  0 siblings, 0 replies; 38+ messages in thread
From: Sébastien Vauban @ 2010-12-20 10:20 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

"Eric Schulte" wrote:
> I've added two hooks, `org-mime-send-subtree-hook' and
> `org-mime-send-buffer-hook' which can be used to do this, for example
> the following
>
> #+begin_src emacs-lisp
>   (add-hook 'org-mime-send-subtree-hook
>             (lambda ()
>               (org-entry-put (point) "mail_sent" (current-time-string))))
> #+end_src

Maybe we could format the time string as an inactive Org timestamp?

I've searched in org-capture for such an example (use of %u) but couldn't spot
one, at least easily.

> will add a mail_sent property with the current time when org-mime-subtree is
> called. The only downside here is that the property is added before the
> email is sent, so choosing not to send the email after reviewing it in the
> message buffer could result in a misleading mail_sent property, in fact
> maybe mail_sent should be changed to mail_composed.

I guess too that that name is better.

FYI, when I'm M-x'ing org-mime-subtree:

- it opens a message mode buffer, but slightly different from the one I have
  if I do `m' in Gnus:

  + no Organization field,
  + no signature
  + etc.

  (I'm using `gnus-alias' for handling on-the-fly personality change)

- after `C-c C-c', it writes it's sent, but then opens Thunderbird!?

I'll have a look at these features.

Best regards,
  Seb

-- 
Sébastien Vauban


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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-19 23:39                 ` Eric Schulte
@ 2010-12-21 20:55                   ` Niels Giesen
  2010-12-27 14:53                     ` Eric Schulte
  2010-12-27 17:53                     ` Samuel Wales
  0 siblings, 2 replies; 38+ messages in thread
From: Niels Giesen @ 2010-12-21 20:55 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

"Eric Schulte" <schulte.eric@gmail.com> writes:

> Niels Giesen <niels.giesen@gmail.com> writes:
>
>> "Eric Schulte" <schulte.eric@gmail.com> writes:
>>
>>> Thanks, I've just pushed up a new version of org-mime which makes use of
>>> this function.
>>

Hi Eric, thanks for implementing this.

However, I see a problem in the solution for when html-ascii is
specified as the MAIL_FMT, being that the same hook will be run for both
parts of the message. I think it better not to have a html-ascii hook
and run the html hook for the html part and the ascii hook for the ascii
part. Otherwise the ascii hook may for instance delete a =BEGIN_SRC=
line and insert cut lines not needed by html.

Same goes for html (which is in fact html-org). Although I cannot really
think of any hooks I might want to run there.

I'll take a look at the link you gave for "Org-mode block fontification"
in gnus, although that seems like a solution for the receiving side, and
most of my peers do not run gnus and org, or emacs for that matter, but
many do want to receive mail in plain text.

On the subject of encouraging so-called code blocks brought to our
attention by Samuel, encouraging this was not my intention, I should
have thought better before posting and I will never in my life post such
immoral examples anymore.

Regards,

Niels

>> [...]
>>
>> Hi Eric,
>>
>> I love the org-mime-subtree function! It makes writing good-looking
>> mails very easy.
>>
>> Now for a proposal:
>>
>> For ascii export used for mail, it would be cool if SRC and EXAMPLE
>> blocks be surrounded by "cut here" scissor lines. They look well in gnus
>> for example:
>>
>
> For even better looking code in gnus, I personally prefer to use org as
> my export target (rather than ascii), and with "Org-mode code block
> fontification" configuration from
> http://eschulte.github.com/emacs-starter-kit/starter-kit-gnus.html
> code blocks inside org-mode markup will be correctly fontified in gnus
> messages.
>
>>
>> code or example here
>>
>> Maybe the best way to achieve this is to define a hook before the string
>> is sent to `org-export-string' with the FMT arg set to 'ascii, so that
>> people can define their own functions. For instance, there are also
>> people who prefer a block like
>>
>
> good idea, I've just added a series of hooks to org-mime which will be
> called in a temporary buffer holding the text to be exported, so you
> could add a function here to add scissor lines around code blocks.  Like
> Sam I would discourage the use of boxquotes for anything that users may
> want to cut and paste.  For ascii use the `org-mime-pre-ascii-hook'.
>
> If you come up with useful hooks it may be nice to share them on worg at
> http://orgmode.org/worg/org-contrib/org-mime.php
>
>>
>> ,----[ emacs-lisp ]
>> | source here
>> `----
>>
>> What do you think?
>>
>> Regards,
>>
>> Niels.
>
> Thanks for the suggestion -- Eric
>
>

-- 
http://pft.github.com/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-21 20:55                   ` Niels Giesen
@ 2010-12-27 14:53                     ` Eric Schulte
  2010-12-27 18:11                       ` Niels Giesen
  2010-12-27 17:53                     ` Samuel Wales
  1 sibling, 1 reply; 38+ messages in thread
From: Eric Schulte @ 2010-12-27 14:53 UTC (permalink / raw)
  To: Niels Giesen; +Cc: emacs-orgmode

Niels Giesen <niels.giesen@gmail.com> writes:

> "Eric Schulte" <schulte.eric@gmail.com> writes:
>
>> Niels Giesen <niels.giesen@gmail.com> writes:
>>
>>> "Eric Schulte" <schulte.eric@gmail.com> writes:
>>>
>>>> Thanks, I've just pushed up a new version of org-mime which makes use of
>>>> this function.
>>>
>
> Hi Eric, thanks for implementing this.
>
> However, I see a problem in the solution for when html-ascii is
> specified as the MAIL_FMT, being that the same hook will be run for both
> parts of the message. I think it better not to have a html-ascii hook
> and run the html hook for the html part and the ascii hook for the ascii
> part. Otherwise the ascii hook may for instance delete a =BEGIN_SRC=
> line and insert cut lines not needed by html.
>
> Same goes for html (which is in fact html-org). Although I cannot really
> think of any hooks I might want to run there.
>

Thanks for pointing this out.  I've just pushed up a fix which
implements a single hook for each format, and (as you suggested) runs
each hook over only the related mime part of the message.

>
> I'll take a look at the link you gave for "Org-mode block fontification"
> in gnus, although that seems like a solution for the receiving side, and
> most of my peers do not run gnus and org, or emacs for that matter, but
> many do want to receive mail in plain text.
>

I like the 'html option for situations like this, as a fontified html
version of the email is sent for normal users, however an org format
exports is supplied as a mime alternative, so users who have instructed
their email clients to prefer plain text will be presented with the
plain text org syntax.  In my wildest of dreams the org-mode begin_src
syntax could be adopted as a plain-text standard for setting off source
code, so that email clients other than gnus could begin providing for
their own fontification of such blocks.

>
> On the subject of encouraging so-called code blocks brought to our
> attention by Samuel, encouraging this was not my intention, I should
> have thought better before posting and I will never in my life post such
> immoral examples anymore.
>

Your consideration is much appreciated. :)

>
> Regards,
>
> Niels
>
>>> [...]
>>>
>>> Hi Eric,
>>>
>>> I love the org-mime-subtree function! It makes writing good-looking
>>> mails very easy.
>>>
>>> Now for a proposal:
>>>
>>> For ascii export used for mail, it would be cool if SRC and EXAMPLE
>>> blocks be surrounded by "cut here" scissor lines. They look well in gnus
>>> for example:
>>>
>>
>> For even better looking code in gnus, I personally prefer to use org as
>> my export target (rather than ascii), and with "Org-mode code block
>> fontification" configuration from
>> http://eschulte.github.com/emacs-starter-kit/starter-kit-gnus.html
>> code blocks inside org-mode markup will be correctly fontified in gnus
>> messages.
>>
>>>
>>> code or example here
>>>
>>> Maybe the best way to achieve this is to define a hook before the string
>>> is sent to `org-export-string' with the FMT arg set to 'ascii, so that
>>> people can define their own functions. For instance, there are also
>>> people who prefer a block like
>>>
>>
>> good idea, I've just added a series of hooks to org-mime which will be
>> called in a temporary buffer holding the text to be exported, so you
>> could add a function here to add scissor lines around code blocks.  Like
>> Sam I would discourage the use of boxquotes for anything that users may
>> want to cut and paste.  For ascii use the `org-mime-pre-ascii-hook'.
>>
>> If you come up with useful hooks it may be nice to share them on worg at
>> http://orgmode.org/worg/org-contrib/org-mime.php
>>
>>>
>>> ,----[ emacs-lisp ]
>>> | source here
>>> `----
>>>
>>> What do you think?
>>>
>>> Regards,
>>>
>>> Niels.
>>
>> Thanks for the suggestion -- Eric
>>
>>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-21 20:55                   ` Niels Giesen
  2010-12-27 14:53                     ` Eric Schulte
@ 2010-12-27 17:53                     ` Samuel Wales
  1 sibling, 0 replies; 38+ messages in thread
From: Samuel Wales @ 2010-12-27 17:53 UTC (permalink / raw)
  To: Niels Giesen; +Cc: emacs-orgmode

On 2010-12-21, Niels Giesen <niels.giesen@gmail.com> wrote:
> On the subject of encouraging so-called code blocks brought to our
> attention by Samuel, encouraging this was not my intention, I should
> have thought better before posting and I will never in my life post such
> immoral examples anymore.

I got a good laugh out of this!

Samuel

-- 
Q: How many CDC "scientists" does it take to change a lightbulb?
A: "You only think it's dark." [CDC has denied a deadly serious
disease for 25 years]
==========
HIV-like virus: http://www.wpinstitute.org/xmrv/index.html -- PLEASE DONATE
===
I want to see the original (pre-hold) Lo et al. 2010 NIH/FDA/Harvard MLV paper.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-27 14:53                     ` Eric Schulte
@ 2010-12-27 18:11                       ` Niels Giesen
  2010-12-28  3:58                         ` Eric Schulte
  0 siblings, 1 reply; 38+ messages in thread
From: Niels Giesen @ 2010-12-27 18:11 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry list for the last two mails (the ones with attachments), I messed
things up there. Below the mail I sent to Eric, but forgot to copy
carbonically to the list.

"Eric Schulte" <schulte.eric@gmail.com> writes:

> Niels Giesen <niels.giesen@gmail.com> writes:
>
>> "Eric Schulte" <schulte.eric@gmail.com> writes:
>>
>>> Niels Giesen <niels.giesen@gmail.com> writes:
>>>
>>>> "Eric Schulte" <schulte.eric@gmail.com> writes:
>>>>
>>>>> Thanks, I've just pushed up a new version of org-mime which makes use of
>>>>> this function.
>>>>
>>
>> Hi Eric, thanks for implementing this.
>>
>> However, I see a problem in the solution for when html-ascii is
>> specified as the MAIL_FMT, being that the same hook will be run for both
>> parts of the message. I think it better not to have a html-ascii hook
>> and run the html hook for the html part and the ascii hook for the ascii
>> part. Otherwise the ascii hook may for instance delete a =BEGIN_SRC=
>> line and insert cut lines not needed by html.
>>
>> Same goes for html (which is in fact html-org). Although I cannot really
>> think of any hooks I might want to run there.
>>
>
> Thanks for pointing this out.  I've just pushed up a fix which
> implements a single hook for each format, and (as you suggested) runs
> each hook over only the related mime part of the message.
>

Thanks. I think I noticed a bug though, being that
`org-mime-pre-html-hook' is run for the ascii and org parts of
html-ascii and org. The code below should fix this:

#+begin_src diff
  Changes in HEAD
      Modified contrib/lisp/org-mime.el
  diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
  index 48c898e..68a3498 100644
  --- a/contrib/lisp/org-mime.el
  +++ b/contrib/lisp/org-mime.el
  @@ -293,7 +293,8 @@ export that region, otherwise export the entire body."
             (html (org-mime-apply-html-hook (car html-and-images))))
        (insert (org-mime-multipart
             (org-export-string
  -           (org-babel-trim (bhook body 'html))
  +           (org-babel-trim
  +            (bhook body (if (eq fmt 'html) 'org 'ascii)))
              (if (eq fmt 'html) 'org 'ascii))
             html)
            (mapconcat 'identity images "\n"))))))))
#+end_src

>>
>> I'll take a look at the link you gave for "Org-mode block fontification"
>> in gnus, although that seems like a solution for the receiving side, and
>> most of my peers do not run gnus and org, or emacs for that matter, but
>> many do want to receive mail in plain text.
>>
>
> I like the 'html option for situations like this, as a fontified html
> version of the email is sent for normal users, however an org format
> exports is supplied as a mime alternative, so users who have instructed
> their email clients to prefer plain text will be presented with the
> plain text org syntax.  In my wildest of dreams the org-mode begin_src
> syntax could be adopted as a plain-text standard for setting off source
> code, so that email clients other than gnus could begin providing for
> their own fontification of such blocks.
>

Now that would be something wild indeed. Of course the upside of org
syntax is that even if nothing is done with it automatically, the human
reader at least has a hint as to what language is used in the code
block, and in that regard it is better than ascii with nondescript
scissor lines. I just might have to revisit my earlier stance on this...

>>
>> On the subject of encouraging so-called code blocks brought to our
>> attention by Samuel, encouraging this was not my intention, I should
>> have thought better before posting and I will never in my life post such
>> immoral examples anymore.
>>
>
> Your consideration is much appreciated. :)
>
>>
>> Regards,
>>
>> Niels
>>
>>>> [...]
>>>>
>>>> Hi Eric,
>>>>
>>>> I love the org-mime-subtree function! It makes writing good-looking
>>>> mails very easy.
>>>>
>>>> Now for a proposal:
>>>>
>>>> For ascii export used for mail, it would be cool if SRC and EXAMPLE
>>>> blocks be surrounded by "cut here" scissor lines. They look well in gnus
>>>> for example:
>>>>
>>>
>>> For even better looking code in gnus, I personally prefer to use org as
>>> my export target (rather than ascii), and with "Org-mode code block
>>> fontification" configuration from
>>> http://eschulte.github.com/emacs-starter-kit/starter-kit-gnus.html
>>> code blocks inside org-mode markup will be correctly fontified in gnus
>>> messages.
>>>
>>>>
>>>> code or example here
>>>>
>>>> Maybe the best way to achieve this is to define a hook before the string
>>>> is sent to `org-export-string' with the FMT arg set to 'ascii, so that
>>>> people can define their own functions. For instance, there are also
>>>> people who prefer a block like
>>>>
>>>
>>> good idea, I've just added a series of hooks to org-mime which will be
>>> called in a temporary buffer holding the text to be exported, so you
>>> could add a function here to add scissor lines around code blocks.  Like
>>> Sam I would discourage the use of boxquotes for anything that users may
>>> want to cut and paste.  For ascii use the `org-mime-pre-ascii-hook'.
>>>
>>> If you come up with useful hooks it may be nice to share them on worg at
>>> http://orgmode.org/worg/org-contrib/org-mime.php
>>>
>>>>
>>>> ,----[ emacs-lisp ]
>>>> | source here
>>>> `----
>>>>
>>>> What do you think?
>>>>
>>>> Regards,
>>>>
>>>> Niels.
>>>
>>> Thanks for the suggestion -- Eric
>>>
>>>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0Y1sUACgkQaDYruO90Vs0XEQCffced4+xBikVknseroYyWpSKv
zG8AoLeBSN7Q4fXIXYD9B5OHFUnxiFx/
=in2/
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Re: Sending org buffer as mail?
  2010-12-27 18:11                       ` Niels Giesen
@ 2010-12-28  3:58                         ` Eric Schulte
  0 siblings, 0 replies; 38+ messages in thread
From: Eric Schulte @ 2010-12-28  3:58 UTC (permalink / raw)
  To: Niels Giesen; +Cc: emacs-orgmode

Niels Giesen <niels.giesen@gmail.com> writes:

>
> Thanks. I think I noticed a bug though, being that
> `org-mime-pre-html-hook' is run for the ascii and org parts of
> html-ascii and org. The code below should fix this:
>

Applied, Thanks -- Eric

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2010-12-28  3:58 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-16  8:04 Sending org buffer as mail? Rainer M Krug
2010-12-16  8:17 ` Oscar Carlsson
2010-12-16  8:25   ` Jeff Horn
2010-12-16  8:54     ` Rainer M Krug
2010-12-16 10:38       ` Oscar Carlsson
2010-12-16 10:41         ` Rainer M Krug
2010-12-16 12:38           ` Rainer M Krug
2010-12-16 13:49             ` Oscar Carlsson
2010-12-16 21:27             ` Sebastian Rose
2010-12-16 21:34             ` Sebastian Rose
2010-12-17  1:06       ` Matt Lundin
2010-12-17  1:27         ` Eric Schulte
2010-12-17  6:48           ` Eric Schulte
2010-12-17  8:57             ` Rainer M Krug
2010-12-17 10:02               ` Eric Schulte
2010-12-17 11:54           ` Matt Lundin
2010-12-17 21:25             ` Eric Schulte
2010-12-19 12:21               ` Niels Giesen
2010-12-19 20:47                 ` Samuel Wales
2010-12-19 23:39                 ` Eric Schulte
2010-12-21 20:55                   ` Niels Giesen
2010-12-27 14:53                     ` Eric Schulte
2010-12-27 18:11                       ` Niels Giesen
2010-12-28  3:58                         ` Eric Schulte
2010-12-27 17:53                     ` Samuel Wales
2010-12-17 14:47           ` Jean-Marie Gaillourdet
2010-12-17 21:26             ` Eric Schulte
2010-12-18 23:26               ` Ethan Ligon
2010-12-20  1:46                 ` Eric Schulte
2010-12-20 10:20                   ` Sébastien Vauban
2010-12-16 10:37     ` Oscar Carlsson
2010-12-16 13:22       ` Eric Schulte
2010-12-16 13:39         ` Rainer M Krug
2010-12-16 14:45         ` Sébastien Vauban
2010-12-16 14:56           ` Eric Schulte
2010-12-16 16:19             ` Sébastien Vauban
2010-12-16 18:20               ` Eric Schulte
2010-12-16 18:29       ` Jeff Horn

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).