From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [ANN] Edit emails in Org-mode
Date: Wed, 19 Jun 2013 20:25:47 +0200 [thread overview]
Message-ID: <8738sedkk4.fsf@gmail.com> (raw)
Hi List,
it is now possible to edit your emails in (full!) Org-mode (assuming you
write them in `message-mode' as Gnus users do).
* Documentation
** Downloads
You need two libraries for this (the optional third library `navi-mode' is
not needed here, but in general very useful in combination with the other two
libraries or Org-mode).
- [[https://github.com/tj64/outshine][outshine.el]]
- [[https://github.com/tj64/outorg][outorg.el]]
Download them or clone the github repos and make sure Emacs finds them.
** Installation
Put this in your '.emacs' file:
#+begin_src emacs-lisp
;; If you want a different prefix key for outline-minor-mode, insert first:
;; (defvar outline-minor-mode-prefix "\C-c") or whatever. The prefix can only
;; be changed before outline (minor) mode is loaded. "\C-c" unfortunately
;; conflicts with other modes, e.g. ESS and picolisp-wiki-mode.
(defvar outline-minor-mode-prefix "\M-#")
(require 'outline)
(require 'outshine)
(add-hook 'outline-minor-mode-hook 'outshine-hook-function)
(add-hook 'message-mode-hook 'outline-minor-mode)
(require 'outorg)
;; optional (require 'navi)
#+end_src
Note that
#+begin_src emacs-lisp
(add-hook 'emacs-lisp-hook 'outline-minor-mode)
#+end_src
is very useful too, though not necessary in this case.
In fact, `outline-minor-mode' extended by the library-trio /outline.el/,
/outorg.el/ and /navi-mode.el/ should work in all kinds of Emacs major-modes
(at least in theory) when files are structured 'the outshine way', i.e. with
outcommented Org-mode headlines (e.g. "^;; [*]+ "). Emacs Lisp files with
conventional headers ("^;;;+ ") are a special case, they work too.
It has been tested with emacs-lisp-mode, picolisp-mode, R-mode, sql-mode,
latex-mode and maybe others I'm not aware of).
** Usage
There are only two commands involved:
| Command | Keybinding | Comment |
|--------------------------------+-------------------+--------------------|
| M-x outorg-edit-as-org | M-# M-# or M-# # | outline-prefix M-# |
| | C-c ' | outline-prefix C-c |
| M-x outorg-copy-edits-and-exit | M-# | --- |
Call `outorg-edit-as-org' in the message-buffer, and the text part of the
unsent email if offered for editing in a temporary Org-mode buffer.
Call `outorg-copy-edits-and-exit' when you are done with editing, and the
content of the temporary edit buffer is copied into the message-mode buffer.
The temporary edit buffer *outorg-edit-buffer* is saved in the /tmp directory
when accidentally killed, so no edits can be lost. You can save the buffer to
its backup file whenever you want with the usual 'C-x C-s'.
*NOTE*
`outorg-edit-as-org' normally acts on the subtree at point, but thats no
problem for the use with `message-mode', except in one situation: When the
message-mode buffer already contains body-text, and this text contains
Org-mode style headlines ("^[*]+ "), then these headlines will be
interpretated by outorg as subtrees during the buffer preparation phase, thus
`outorg-edit-as-org' will act only on the first subtree.
In this case, simply call `outorg-edit-as-org' with prefix, e.g. 'C-u M-#
M-#', then the whole mail body will be offered for editing in Org-mode.
** Alternatives
You can use `orgstruct-minor-mode' to make a subset of Org-mode's
functionality available in `message-mode'. The extra-cost of using the
combination of `outshine' and `outorg' instead is typing once 'M-# M-#' and
once 'M-#', the extra-benefit is the *full* power of Org-mode at your
fingertips when writing emails.
** Read more
There is an article on
[[http://orgmode.org/worg/org-tutorials/org-outside-org.html][Worg]]
about the libraries described in this post.
** Example
This email has be written in the *outorg-edit-buffer*, so I can do some stuff
not necessarily associated with writing email. Lets export this mail to ASCII
and attach the result below - without leaving this buffer of course (except
for editing the source-block), just by doing 'C-c C-c' inside the block:
#+begin_src emacs-lisp :results output replace
(org-export-to-buffer 'ascii "email-transcode-buffer")
(print
(with-current-buffer "email-transcode-buffer"
(let ((mail-as-ascii
(buffer-substring-no-properties (point-min) (point-max))))
(set-buffer-modified-p nil)
(kill-buffer)
mail-as-ascii)))
#+end_src
#+results:
" _________________
134
Thorsten Jolitz
_________________
Table of Contents
_________________
1 --text follows this line--
2 Documentation
.. 2.1 Downloads
.. 2.2 Installation
.. 2.3 Usage
.. 2.4 Alternatives
.. 2.5 Read more
.. 2.6 Example
1 --text follows this line--
============================
Hi List,
it is now possible to edit your emails in (full!) Org-mode (assuming
you write them in `message-mode' as Gnus users do).
2 Documentation
===============
2.1 Downloads
~~~~~~~~~~~~~
You need two libraries for this (the optional third library
`navi-mode' is not needed here, but in general very useful in
combination with the other two libraries or Org-mode).
- [outshine.el]
- [outorg.el]
Download them or clone the github repos and make sure Emacs finds
them.
[outshine.el] https://github.com/tj64/outshine
[outorg.el] https://github.com/tj64/outorg
2.2 Installation
~~~~~~~~~~~~~~~~
Put this in your '.emacs' file:
,----
| ;; If you want a different prefix key for outline-minor-mode, insert first:
| ;; (defvar outline-minor-mode-prefix \"\\C-c\") or whatever. The prefix can only
| ;; be changed before outline (minor) mode is loaded. \"\\C-c\" unfortunately
| ;; conflicts with other modes, e.g. ESS and picolisp-wiki-mode.
| (defvar outline-minor-mode-prefix \"\\M-#\")
|
| (require 'outline)
| (require 'outshine)
|
| (add-hook 'outline-minor-mode-hook 'outshine-hook-function)
| (add-hook 'message-mode-hook 'outline-minor-mode)
|
| (require 'outorg)
| ;; optional (require 'navi)
`----
Note that
,----
| (add-hook 'emacs-lisp-hook 'outline-minor-mode)
`----
is very useful too, though not necessary in this case.
In fact, `outline-minor-mode' extended by the library-trio
/outline.el/, /outorg.el/ and /navi-mode.el/ should work in all kinds
of Emacs major-modes (at least in theory) when files are structured
'the outshine way', i.e. with outcommented Org-mode headlines (e.g.
\"^;; [*]+ \"). Emacs Lisp files with conventional headers (\"^;;;+ \")
are a special case, they work too.
It has been tested with emacs-lisp-mode, picolisp-mode, R-mode,
sql-mode, latex-mode and maybe others I'm not aware of).
2.3 Usage
~~~~~~~~~
There are only two commands involved:
Command Keybinding Comment
-----------------------------------------------------------------------
M-x outorg-edit-as-org M-# M-# or M-# # outline-prefix M-#
C-c ' outline-prefix C-c
M-x outorg-copy-edits-and-exit M-# ---
Call `outorg-edit-as-org' in the message-buffer, and the text part of
the unsent email if offered for editing in a temporary Org-mode
buffer.
Call `outorg-copy-edits-and-exit' when you are done with editing, and
the content of the temporary edit buffer is copied into the
message-mode buffer.
The temporary edit buffer *outorg-edit-buffer* is saved in the /tmp
directory when accidentally killed, so no edits can be lost. You can
save the buffer to its backup file whenever you want with the usual
'C-x C-s'.
*NOTE* `outorg-edit-as-org' normally acts on the subtree at point, but
thats no problem for the use with `message-mode', except in one
situation: When the message-mode buffer already contains body-text,
and this text contains Org-mode style headlines (\"^[*]+ \"), then these
headlines will be interpretated by outorg as subtrees during the
buffer preparation phase, thus `outorg-edit-as-org' will act only on
the first subtree.
In this case, simply call `outorg-edit-as-org' with prefix, e.g. 'C-u
M-# M-#', then the whole mail body will be offered for editing in
Org-mode.
2.4 Alternatives
~~~~~~~~~~~~~~~~
You can use `orgstruct-minor-mode' to make a subset of Org-mode's
functionality available in `message-mode'. The extra-cost of using the
combination of `outshine' and `outorg' instead is typing once 'M-#
M-#' and once 'M-#', the extra-benefit is the *full* power of Org-mode
at your fingertips when writing emails.
2.5 Read more
~~~~~~~~~~~~~
There is an article on [Worg] about the libraries described in this
post.
[Worg] http://orgmode.org/worg/org-tutorials/org-outside-org.html
2.6 Example
~~~~~~~~~~~
This email has be written in the *outorg-edit-buffer*, so I can do
some stuff not necessarily associated with writing email. Lets export
this mail to ASCII and attach the result below - without leaving this
buffer of course (except for editing the source-block), just by doing
'C-c C-c' inside the block:
,----
| (org-export-to-buffer 'ascii \"email-transcode-buffer\")
| (print
| (with-current-buffer \"email-transcode-buffer\"
| (let ((mail-as-ascii
| (buffer-substring-no-properties (point-min) (point-max))))
| (set-buffer-modified-p nil)
| (kill-buffer)
| mail-as-ascii)))
`----
-- cheers, Thorsten
"
--
cheers,
Thorsten
next reply other threads:[~2013-06-19 18:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 18:25 Thorsten Jolitz [this message]
2013-06-20 7:06 ` [ANN] Edit emails in Org-mode Sebastien Vauban
2013-06-20 12:01 ` Thorsten Jolitz
2013-06-21 7:24 ` Sebastien Vauban
2013-06-21 11: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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8738sedkk4.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.