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 [EMAIL PROTECTED] PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
#!/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 <[EMAIL PROTECTED]> # # 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);
_______________________________________________ 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