emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] emails written in Org Mode


From: Thorsten Jolitz
Subject: Re: [O] emails written in Org Mode
Date: Wed, 09 Jul 2014 09:49:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Ken Mankoff <address@hidden> writes:

Hi Ken, 

> Hi Thorsten,  On a recent thread you wrote: 
>
>> ... *outorg-edit-buffer* (where I write my message-mode email in
>> full
>> org-mode).
>
> I already write emails in emacs. I'm interested in being able to compose
> emails using Org Mode. I see you use gnus. I use mu4e[1]. I wonder if
> your setup is gnus-specific or might work with other emacs mail
> clients. Will you provide some information about this?

Yes, I use Gnus and thus write my mails in message-mode. 

My setup is the standard outshine.el + outorg.el setup, since it works
out-of-the-box with message-mode, given you follow the installation
description. 

In my init file I have (note that '(try-require 'foo) is basically
'(require 'foo nit t), and that outorg is required by navi-mode
anyway.):

,----
| (message "\n------ entering outline ------")
| 
| (when (try-require 'outline)
| (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
| (add-hook 'message-mode-hook 'outline-minor-mode))
| 
| ;; outorg
| ;; (try-require 'outorg)
| 
| ;; outshine
| (try-require 'outshine)
| (add-hook 'outline-minor-mode-hook 'outshine-hook-function)
| 
| (setq outshine-use-speed-commands t)
| 
| ;; navi-mode
| (try-require 'navi-mode)
| 
| ;; poporg
| (try-require 'poporg)
`----

You can get outshine/outorg/navi via MELPA or from github (repo tj64).

My workflow is more or less like this:

 - start writing email in message-mode (just the Gnus default)

 - while writing, come to the conclusion that I need a table, or want to
   insert and evalute src_blocks, or want to attach the email exported
   to ASCII etc etc - and switch to Org-mode with M-# # (M-x
   outorg-edit-as-org)

############################################################

I did this right now, here is how this email looks in the
*outorg-edit-buffer*: 

,----
| * --text follows this line--
| Ken Mankoff <address@hidden> writes:
| 
| Hi Ken, 
| 
| > Hi Thorsten,  On a recent thread you wrote: 
| >
| >> ... *outorg-edit-buffer* (where I write my message-mode email in
| >> full
| >> org-mode).
| >
| > I already write emails in emacs. I'm interested in being able to compose
| [...]
| Yes, I use Gnus and thus write my mails in message-mode. My setup is the
| standard outshine.el + outorg.el setup, since it works out-of-the-box
| with message-mode. 
| 
| My workflow is more or less like this:
| 
|  - start writing email in message-mode (just the Gnus default)
|  [...]
`----

You can see that in outorg.el I just use a trick to make it work with
message-mode - I prepare the message-mode buffer in such a way that
outorg can work with it (i.e. I make it an outshine buffer by
 
 1. turning this line into an Org headline:

   ,----
   | * --text follows this line--
   `----

 2. commenting out all text

Then outorg can convert the buffer to Org like it can convert any other
outshine buffer (outshine is major-mode agnostic, it works, at least in
theory, with all major-modes). 

One nice thing about this is that you can do code-block evaluation
directly in the *outorg-edit-buffer*, no buffer switching and copy&paste
necessary anymore.

############################################################

 - when I'm finished editing in Org I just do M-# (M-x
   outorg-copy-edits-and-exit) to get back to message-mode. For
   message-mode, the buffer gets some special treatment when converting
   back from Org-mode (basically undo the trick I used in the
   beginning). 

So in summary, in outorg I

 1. check if original buffer is in message-mode
 2. if so, prepare buffer for editing in Org (do trick)
 3. convert buffer to Org
 4. edit in Org
 5. prepare buffer for converting back to message-mode (undo trick)
 5. reconvert buffer to message-mode

I would guess that this could easily be ported to mu4e. In step 1 I
could check for mu4e too, and write two mu4e-functions for buffer
preparation (converting to and from Org-mode) - thats all. 

I only would need to know how a message-buffer looks like in mu4e. In
message-mode it looks basically like this 

,----
| References: <address@hidden>
| X-Draft-From: ("nntp+news.gmane.org:gmane.emacs.orgmode" 88376)
| Newsgroups: gmane.emacs.orgmode
| Subject: Re: emails written in Org Mode
| From: Thorsten Jolitz <address@hidden>
| Gcc: nnfolder+archive:sent.2014-07
| --text follows this line--
| 
| -- 
| cheers,
| Thorsten
`----

and I do a 

,----
|  (re-search-forward mail-header-separator nil 'NOERROR)
`----

to search for this line

,----
| --text follows this line--
`----

and figure out where the message body starts. If you could provide me
with a reliable template for a mu4e message and some kind of always
present mail-header-separator, I could try to make outorg work with mu4e
too. 

PS

> [1] http://www.djcbsoftware.nl/code/mu/mu4e.html

Reads interesting, I had not heard of it. I probably use only 1pc of
Gnus functionality, and it was kind of a pain to set it up, but now that
it works its very comfortable so I'm probably not going to switch.

-- 
cheers,
Thorsten




reply via email to

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