aboutsummaryrefslogtreecommitdiff
path: root/bin/mutt-remember-mail
diff options
context:
space:
mode:
authorRaul Benencia <rul@kalgan.cc>2020-05-24 13:44:14 -0700
committerRaul Benencia <rul@kalgan.cc>2020-05-24 13:47:59 -0700
commit546a3a211a0d59f14edbd97c1990476e84a46247 (patch)
treec5709cc4a8f7b0f39e1cb023f0f6b03bf749272e /bin/mutt-remember-mail
parent3589f3e66769e87831e9f31fb3493064dd3ce73e (diff)
Add bin/ repo from home-bin/ repo
Diffstat (limited to 'bin/mutt-remember-mail')
-rwxr-xr-xbin/mutt-remember-mail23
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/mutt-remember-mail b/bin/mutt-remember-mail
new file mode 100755
index 0000000..e9898f5
--- /dev/null
+++ b/bin/mutt-remember-mail
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+#
+# Helper for mutt to remember mails in Emacs' Org mode
+#
+# Copyright: © 2009-2010 Stefano Zacchiroli <zack@upsilon.cc>
+# License: GNU General Public License (GPL), version 3 or above
+#
+# Example of mutt macro to invoke this hitting ESC-R (to be put in ~/.muttrc):
+# macro index \eR "|~/bin/remember-mail\n"
+
+use strict;
+use Mail::Internet;
+use URI::Escape;
+
+my $msg = Mail::Internet->new(\*STDIN);
+$msg->head->get('message-id') =~ /^<(.*)>$/;
+my $mid = $1;
+my $subject = $msg->head->get('subject') || "";
+my $from = $msg->head->get('from') || "";
+chomp ($subject, $from);
+my $note_body = uri_escape(" Subject: $subject\n From: $from");
+
+exec "emacsclient", "-c", "org-protocol:/capture:/m/mutt:$mid/mail/$note_body";
nihil fit ex nihilo