From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell Adams Subject: Mairix & Mutt Date: Sat, 20 Sep 2008 23:58:54 -0500 Message-ID: <20080921045854.GA24656@thinkpad.adamsinfoserv.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ibTvN161/egqYuK8" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KhH2G-0000TK-Td for emacs-orgmode@gnu.org; Sun, 21 Sep 2008 00:59:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KhH2F-0000So-Mn for emacs-orgmode@gnu.org; Sun, 21 Sep 2008 00:59:04 -0400 Received: from [199.232.76.173] (port=46205 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KhH2F-0000Sg-FL for emacs-orgmode@gnu.org; Sun, 21 Sep 2008 00:59:03 -0400 Received: from squirtle.drak.net ([72.52.144.201]:35020) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KhH2F-0003iM-9h for emacs-orgmode@gnu.org; Sun, 21 Sep 2008 00:59:03 -0400 Received: from [206.180.154.148] (helo=localhost) by squirtle.drak.net with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1KhH1y-0003Ot-GI for emacs-orgmode@gnu.org; Sat, 20 Sep 2008 23:58:48 -0500 Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode List --ibTvN161/egqYuK8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --ibTvN161/egqYuK8 Content-Type: text/x-perl; charset=us-ascii Content-Disposition: attachment; filename="mutt2org.pl" #!/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 # # 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\` "=._Search/\n" # macro index \e\` "=._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 "\ # unset wait_key\n\ # ~/.dotfiles/mutt/mutt2org.pl\n\ # set wait_key\n\ # " "Create Org link in X clipboard" # # macro pager \eo "\ # unset wait_key\n\ # ~/.dotfiles/mutt/mutt2org.pl\n\ # set wait_key\n\ # " "Create Org link in X clipboard" # ###################################################################### use strict; use warnings; use 5.010; my ( $Subject , $From , $MID ); while () { 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); --ibTvN161/egqYuK8 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --ibTvN161/egqYuK8--