all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Mairix & Mutt
@ 2008-09-21  4:58 Russell Adams
  2008-09-21  8:24 ` [AvataR]
  2008-09-27 11:18 ` Friedrich Delgado Friedrichs
  0 siblings, 2 replies; 6+ messages in thread
From: Russell Adams @ 2008-09-21  4:58 UTC (permalink / raw)
  To: Org Mode List

[-- 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-09-27 13:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-21  4:58 Mairix & Mutt Russell Adams
2008-09-21  8:24 ` [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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.