From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: emails written in Org Mode Date: Wed, 09 Jul 2014 09:49:21 +0200 Message-ID: <87zjgjvuny.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4mdO-0005yS-WC for emacs-orgmode@gnu.org; Wed, 09 Jul 2014 03:49:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4mdI-0003sH-Id for emacs-orgmode@gnu.org; Wed, 09 Jul 2014 03:49:46 -0400 Received: from plane.gmane.org ([80.91.229.3]:44370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4mdI-0003sB-8y for emacs-orgmode@gnu.org; Wed, 09 Jul 2014 03:49:40 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X4mdE-0004cp-S6 for emacs-orgmode@gnu.org; Wed, 09 Jul 2014 09:49:36 +0200 Received: from g231106182.adsl.alicedsl.de ([92.231.106.182]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 09 Jul 2014 09:49:36 +0200 Received: from tjolitz by g231106182.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 09 Jul 2014 09:49:36 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Ken Mankoff 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 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: | 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 | 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