From: Russell Adams <RLAdams@AdamsInfoServ.Com>
To: Org Mode List <emacs-orgmode@gnu.org>
Subject: Mairix & Mutt
Date: Sat, 20 Sep 2008 23:58:54 -0500 [thread overview]
Message-ID: <20080921045854.GA24656@thinkpad.adamsinfoserv.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]
Tonight I cobbled together a quick hack to let me store links from an
external mutt session directly into Org as a link via paste from the X
windows paste buffer.
I thought I would share. Documentation is in the comment header of the
script.
The workflow goes like this:
- Reading email in Mutt, in index or pager
- Trigger script via M-o in Mutt
- Middle-click into my org-mode buffer pasting the link
- Later visit the link and execute mairix to find message by ID
- In current Mutt session, use M-` to jump to search folder and read
message
Attached is the perl script which generates the link and populates the
paste buffer via xclip. It occurred to me I might be able to use
org-mairix.el and use a mairix style link instead of an exec, but this
suffices for the time being.
Enjoy!
------------------------------------------------------------------
Russell Adams RLAdams@AdamsInfoServ.com
PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/
Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
[-- Attachment #2: mutt2org.pl --]
[-- Type: text/x-perl, Size: 1945 bytes --]
#!/usr/bin/perl
######################################################################
# mutt2org.pl
#
# Read an email on STDIN and fetch headers to create an org-mode
# link which executes mairix to find the correct message.
#
# Later when the link is visited, mairix will find the message by id.
# Then the user can goto their search folder in mutt to view it.
#
# Licensed GPL v2: Russell Adams <rladams@adamsinfoserv.com>
#
# The following are excerpts from .muttrc to speed up mairix related
# activities.
#
# Given that the mairix folder is "=._Search/", the following allows
# M-` to jump directly to the search folder.
#
# ~/.muttrc:
# # Quick access to mairix search folder
# macro pager \e\` "<change-folder>=._Search/\n"
# macro index \e\` "<change-folder>=._Search/\n"
#
# Bind M-o to this perl script without pause in the index and pager
# allowing for quick paste into Org.
#
# ~/.muttrc:
# macro index \eo "\
# <enter-command>unset wait_key\n\
# <pipe-entry>~/.dotfiles/mutt/mutt2org.pl\n\
# <enter-command>set wait_key\n\
# " "Create Org link in X clipboard"
#
# macro pager \eo "\
# <enter-command>unset wait_key\n\
# <pipe-entry>~/.dotfiles/mutt/mutt2org.pl\n\
# <enter-command>set wait_key\n\
# " "Create Org link in X clipboard"
#
######################################################################
use strict;
use warnings;
use 5.010;
my ( $Subject , $From , $MID );
while (<STDIN>) {
chomp;
given ($_) {
when (/^Subject: /) { ( $Subject ) = $_ =~ m/^Subject: (.*)$/; };
when (/^From: /) { ( $From ) = $_ =~ m/^From: (.*)$/; };
when (/^Message-ID:\s*/) { ( $MID ) = $_ =~ m/^Message-ID:\s*<(.*)>\s*$/; };
when (/^$/) { break; }; # Header ends on first blank line
}
};
# Compose link
my $Link = "[[shell:mairix \"m:$MID\"][$From / $Subject]]";
# Output to xclip, avoiding shell escape headaches with exec.
open(PIPE, "|/usr/bin/xclip");
say PIPE "$Link";
close(PIPE);
[-- Attachment #3: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next reply other threads:[~2008-09-21 4:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-21 4:58 Russell Adams [this message]
2008-09-21 8:24 ` Mairix & Mutt [AvataR]
2008-09-21 14:22 ` Russell Adams
2008-09-27 11:18 ` Friedrich Delgado Friedrichs
2008-09-27 12:16 ` Russell Adams
2008-09-27 13:02 ` Friedrich Delgado Friedrichs
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080921045854.GA24656@thinkpad.adamsinfoserv.com \
--to=rladams@adamsinfoserv.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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).