check-in remember-mail
[org-mutt] / remember-mail
1 #!/usr/bin/perl -w
2 #
3 # Helper for mutt to remember mails in Emacs' Org mode
4 #
5 # Copyright: © 2009-2010 Stefano Zacchiroli <zack@upsilon.cc> 
6 # License: GNU General Public License (GPL), version 3 or above
7 #
8 # Example of mutt macro to invoke this hitting ESC-R (to be put in ~/.muttrc):
9 #  macro index \eR "|~/bin/remember-mail\n"
10
11 use strict;
12 use Mail::Internet;
13 use URI::Escape;
14
15 my $msg = Mail::Internet->new(\*STDIN);
16 $msg->head->get('message-id') =~ /^<(.*)>$/;
17 my $mid = $1;
18 my $subject = $msg->head->get('subject') || "";
19 my $from = $msg->head->get('from') || "";
20 chomp ($subject, $from);
21 my $note_body = uri_escape("  Subject: $subject\n    From: $from");
22
23 exec "emacsclient", "-t", "org-protocol:/remember:/m/mutt:$mid/mail/$note_body";

Benjamin Mako Hill || Want to submit a patch?