emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: emails written in Org Mode
Date: Wed, 09 Jul 2014 09:49:21 +0200	[thread overview]
Message-ID: <87zjgjvuny.fsf@gmail.com> (raw)
In-Reply-To: m2pphfr9an.fsf@gmail.com

Ken Mankoff <mankoff@gmail.com> 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 <mankoff@gmail.com> 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: <m2pphfr9an.fsf@gmail.com>
| 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 <tjolitz@gmail.com>
| 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

  parent reply	other threads:[~2014-07-09  7:49 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 18:28 emails written in Org Mode Ken Mankoff
2014-07-09  5:06 ` Joseph Vidal-Rosset
     [not found]   ` <CAAjq1me3p_QPNf_UyXsbO2A4B7t_vVAAi-nL-k5wNsq0AU2J7w@mail.gmail.com>
2014-07-11  6:48     ` Joseph Vidal-Rosset
2014-07-09  7:49 ` Thorsten Jolitz [this message]
2014-07-10 12:57   ` Alan Schmitt
2014-07-10 13:27     ` Thorsten Jolitz
2014-07-11  9:32       ` Alan Schmitt
2014-07-09 19:14 ` John Kitchin
2014-07-09 20:03   ` Nick Dokos
2014-07-09 20:14     ` Ken Mankoff
2014-07-10  8:28       ` Thorsten Jolitz
2014-07-10 10:41         ` Ken Mankoff
2014-07-10 11:29           ` Thorsten Jolitz
2014-07-09 22:33   ` Eric Abrahamsen
2014-07-10  0:33   ` Thorsten Jolitz
2014-07-10 21:15   ` Esben Stien
2014-07-14  1:05   ` Esben Stien
2014-07-14 13:34     ` Esben Stien
2014-07-14 22:49       ` John Kitchin
2014-07-15  0:41         ` Eric Abrahamsen
2014-07-15  0:57           ` Thorsten Jolitz
2014-07-15  1:52             ` Eric Abrahamsen
2014-07-15 14:11             ` Alan Schmitt
2014-07-15 14:16               ` Joseph Vidal-Rosset
2014-07-16  3:03                 ` Eric Abrahamsen
2014-07-16 17:02                   ` Joseph Vidal-Rosset
2014-07-16  3:08                 ` Eric Abrahamsen
2014-07-09 20:02 ` Noorul Islam K M
2014-07-10  0:44 ` Thorsten Jolitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zjgjvuny.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).