tags/orgmodezack's home pagehttp://upsilon.cc/~zack/tags/orgmode/zack's home pageikiwiki2015-03-09T09:21:47Zinterview for The Setuphttp://upsilon.cc/~zack/blog/posts/2015/03/interview_for_The_Setup/2015-03-09T09:21:47Z2015-03-09T09:21:47Z
<h1>my setup, take #2</h1>
<p>Look Ma, I've been <a href=
"http://stefano.zacchiroli.usesthis.com/">interviewed</a> by
<a href="http://usesthis.com/">The Setup</a>, a popular blog with
<em>"interviews asking people from all walks of life what they use
to get the job done"</em>; so I now sport a fancy <a href=
"http://stefano.zacchiroli.usesthis.com">http://stefano.zacchiroli.usesthis.com</a>
too.</p>
<p>While there is overlap with <a href=
"http://upsilon.cc/~zack/blog/posts/2014/09/interview_for_the_gnu_linux_setup/">my
previous take</a> on my setup, the questions are different so most
of the content is novel. In particular, I quite enjoyed the
question about what would be my "dream setup", and indulged in free
software/hardware desiderata.</p>
<p>Many thanks to Daniel Bogan for running the blog and kudos for
his editing work: while it's just a detail, such an abundance and
quality of link titles is not easy to come by on the Web.</p>
interview for the gnu linux setuphttp://upsilon.cc/~zack/blog/posts/2014/09/interview_for_the_gnu_linux_setup/2014-09-03T14:02:16Z2014-09-03T08:48:14Z
<h1>my setup, take #1</h1>
<p>Among the various things I've catched up with during the summer,
I've finally managed to set aside some time to answer a pending
<a href=
"http://www.mylinuxrig.com/post/96462880004/the-linux-setup-stefano-zacchiroli-former-debian">
interview</a> request for <a href=
"http://www.mylinuxrig.com/setup">The [GNU/]Linux Setup</a>: a blog
run by Steven Ovadia that collects interviews about how people use
GNU/Linux-based desktops.</p>
<p>In the interview I discuss my day to day work-flow, from GNOME
Shell to Mutt, from Emacs to Notmuch, and the various glue code
tools I've written for integrating them.</p>
<p><a href=
"http://www.mylinuxrig.com/post/96462880004/the-linux-setup-stefano-zacchiroli-former-debian">
Enjoy</a>!</p>
<p>Feedback is most welcome.</p>
org-mutt ported to org-capturehttp://upsilon.cc/~zack/blog/posts/2013/10/org-mutt_ported_to_org-capture/2013-10-17T07:40:07Z2013-10-17T07:38:11Z
<h1>org-mutt with org-mode >= 8</h1>
<p>Thanks to <a href=
"http://www.donarmstrong.com/posts/org_mode_mutt_capture/">Don</a>
I just remembered that I haven't yet announced org-mutt support for
org-mode >= 8. Let's catch up!</p>
<p>Since a few weeks I've been aware of the fact that my <a href=
"http://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/"><strong>mutt/org-mode
glue</strong></a>, AKA <strong>org-mutt</strong>, was no longer
working with <a href="http://orgmode.org/">org-mode</a> >= 8,
due to the ditching of org-remember in favor of org-capture.
Allegedly, org-capture should have been backward compatible, but it
clearly is not.</p>
<p>Before I had time to fix it myself, <a href=
"http://mako.cc/">Mako</a> came to my rescue and submitted <a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=commit;h=ec7aa6e44ef39a2645ec40f1fe1700a7af47544f">
a patch</a> (now accepted) that does the needed porting. Free
Software is truly amazing, isn't it?</p>
<p>I've just updated the canonical <a href=
"http://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/">org-mutt
blog post</a>, so that the documentation in there is up to date
again. If you're using org-mutt, I suggest to refer to the <a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=summary"><strong>Git
repository</strong></a> as the canonical location for future
updates, if any.</p>
<p>Thanks Don, thanks Mako!</p>
integrating Mutt with Org-modehttp://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/2013-10-17T07:38:11Z2010-02-08T14:09:41Z
<h1>remember Mutt's mail in Org-mode and jump back to them</h1>
<p>As <a href=
"http://upsilon.cc/~zack/blog/posts/2009/10/mail_indexing_for_mutt/">already
anticipated</a>, I've been implementing my own <a href=
"https://en.wikipedia.org/wiki/Getting%5FThings%5FDone">Getting
Things Done</a> work flow. This post documents one of its main
bricks: the <strong>integration between <a href=
"http://www.mutt.org/">Mutt</a> and <a href=
"http://orgmode.org">Org-mode</a></strong>.</p>
<p>As a geek, my main incoming stream of TODO items and information
in general is email. As emails hit my INBOX, I either deal with
them immediately (reply, archive, delete) or I need to store them
elsewhere, possibly adding extra information such as a deadline, a
personal note, the associated next action, the context in which it
is actionable, etc. This need of adding extra information is what
defeats the usage of my mail client (Mutt) as a list manager (in
the GTD sense), and that's where I plugged Org-mode in. My main
goals are:</p>
<ol>
<li>
<p><strong>create Org-mode notes from Mutt</strong>, referencing
the current email, and possibly inlining some of its metadata (e.g.
subject, sender)</p>
</li>
<li>
<p>quickly <strong>retrieve referenced emails from Org-mode
notes</strong>; ideally that should happen in my usual email
environment (i.e. Mutt), so that I can process the retrieved mail
as usual (e.g. to inform the sender that I did something about
it)</p>
</li>
</ol>
<p><small>In fact, both would be straightforward to achieve if I
were using some Emacs-based mail client such as <a href=
"http://www.gnus.org/">Gnus</a>, but <a href=
"http://upsilon.cc/~zack/blog/posts/2008/11/from_Vim_to_Emacs_-_part_2/">I resist the
<em>Emacs operating system syndrome</em></a>, and therefore I
insist in using my beloved Mutt.</small></p>
<p>Let's see how the two parts of the interaction between Mutt and
Org-mode work.</p>
<h2><small>(1)</small> Mutt → Org-mode <small><em>(there
...)</em></small></h2>
<p>The interaction from Mutt to Org-mode happens via <a href=
"http://orgmode.org/worg/org-contrib/org-protocol.php">org-protocol</a>.
Using it external applications can feed content to Org-mode note
templates, which are then interactively edited (via <a href=
"http://www.emacswiki.org/emacs/EmacsClient">emacsclient</a>), and
finally filed away.</p>
<p>The Mutt glue macro from my <code>~/.muttrc</code> is as
follow:</p>
<pre><code>macro index \eR "|~/bin/remember-mail\n"
</code></pre>
<p>The <a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=blob_plain;f=remember-mail;hb=HEAD">
remember-mail</a> script is trivial: it parses the fed mail from
STDIN (using a couple of legacy Perl modules) and then invokes
org-protocol.</p>
<p>The relevant configuration from my <code>~/.emacs</code> is
reported below (see the Git repo for the <a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=blob_plain;f=emacs-conf.sample;hb=HEAD">
most recent version of this</a>); the comments explain the various
parts:</p>
<pre><code>;; standard org <-> remember stuff, RTFM
(require 'org-capture)
(setq org-default-notes-file "~/org/gtd.org")
(setq org-capture-templates
(quote
(("m"
"Mail"
entry
(file+headline "~/org/gtd.org" "Incoming")
"* TODO %^{Title}\n\n Source: %u, %c\n\n %i"
:empty-lines 1)
;; ... more templates here ...
)))
;; ensure that emacsclient will show just the note to be edited when invoked
;; from Mutt, and that it will shut down emacsclient once finished;
;; fallback to legacy behavior when not invoked via org-protocol.
(add-hook 'org-capture-mode-hook 'delete-other-windows)
(setq my-org-protocol-flag nil)
(defadvice org-capture-finalize (after delete-frame-at-end activate)
"Delete frame at remember finalization"
(progn (if my-org-protocol-flag (delete-frame))
(setq my-org-protocol-flag nil)))
(defadvice org-capture-kill (after delete-frame-at-end activate)
"Delete frame at remember abort"
(progn (if my-org-protocol-flag (delete-frame))
(setq my-org-protocol-flag nil)))
(defadvice org-protocol-capture (before set-org-protocol-flag activate)
(setq my-org-protocol-flag t))
</code></pre>
<p>The result is that when you hit <code>ESC-R</code> in Mutt,
emacsclient will be fired up in place presenting a note template
that already contains relevant mail information (date, subject,
from) and lets you add extra information before going away.
Additionally, the email message-id will be hidden in the note as a
<code>mutt:</code> hyperlink with anchor text "mail".</p>
<h2><small>(2)</small> Org-mode → Mutt <small><em>(... and back
again)</em></small></h2>
<p>Going back means that clicking on a "mail" hyperlink within an
Org-mode note should bring up a Mutt instance showing the original
message, in its context (e.g. its own mailbox). Achieving that
consists of 2 separate steps:</p>
<ol>
<li>looking up a specific message by <code>Message-ID</code></li>
<li>firing up Mutt on the looked up message</li>
</ol>
<p>For the first part I use <a href=
"http://packages.debian.org/sid/notmuch%2Dmutt">notmuch-mutt</a>
(see this other <a href=
"http://upsilon.cc/~zack/blog/posts/2011/01/how_to_use_Notmuch_with_Mutt/">blog
post</a> of mine).</p>
<p>For the second part I use the <a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=blob_plain;f=mutt-open;hb=HEAD">
mutt-open</a> script which fires upon a Mutt instance on the
maildir containing a specific message, and then "hits" the
appropriate keys to open the message and shutdown <a href=
"http://packages.debian.org/lenny/mutt-patched">the sidebar</a> (if
desired). It is a nicely reusable script, which I've being using
elsewhere too.</p>
<p>The needed glue on the emacs side is just a function to invoke
<code>mutt-open</code> in a brand new terminal, and its declaration
as the handler for <code>mutt:</code> URLs.</p>
<pre><code>(defun open-mail-in-mutt (message)
"Open a mail message in Mutt, using an external terminal.
Message can be specified either by a path pointing inside a
Maildir, or by Message-ID."
(interactive "MPath or Message-ID: ")
(shell-command
(format "gnome-terminal -e \"%s %s\""
(substitute-in-file-name "$HOME/bin/mutt-open") message)))
;; add support for "mutt:ID" links
(org-add-link-type "mutt" 'open-mail-in-mutt)
</code></pre>
<p>Voilà!</p>
<h2>Download</h2>
<p>Scripts and configuration snippets discussed above are available
from the <a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=summary">org-mutt
Git repository</a>:</p>
<ul>
<li><a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=blob_plain;f=remember-mail;hb=HEAD">
remember-mail</a> - store in Org-mode a note back-referencing an
email</li>
<li><a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=blob_plain;f=mutt-open;hb=HEAD">
mutt-open</a> - open Mutt on an email having a specific
<code>Message-ID</code></li>
<li><a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=blob_plain;f=emacs-conf.sample;hb=HEAD">
Emacs configuration</a></li>
<li><a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=blob_plain;f=mutt-conf.sample;hb=HEAD">
Mutt configuration</a></li>
</ul>
<hr />
<p><strong>Update 22/01/2011:</strong> fix mutt-open to work with
maildir-utils, version 7 or above<br />
<strong>Update 17/02/2012:</strong> move scripts and conf to the
<a href=
"http://git.upsilon.cc/?p=utils/org-mutt.git;a=summary">org-mutt
Git repo</a><br />
<strong>Update 17/10/2013:</strong> point to notmuch-mutt blog
post, getting rid of mu<br />
<strong>Update 17/10/2013:</strong> update Emacs conf snippet for
Org >= 0.8 (see Git repo)<br /></p>