<<< Date Index >>>     <<< Thread Index >>>

Re: tagurl.pl



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday, May 20 at 08:33 AM, quoth Wilkinson, Alex:
>    0n Mon, May 19, 2008 at 03:45:12PM -0500, Kyle Wheeler wrote:
>
>    > I put up a webpage for my tagurl.pl script: 
>    > http://www.memoryhole.net/~kyle/tagurl/
>
> After having a quick read of the page I still dont really get what 
> this script does :(

Hmmm... well, so here's the problem it's addressing: at the moment, if  
someone sends you an email with a URL in it that you want to open, 
what you have to do is either copy and paste the URL from your 
terminal, or rely on your terminal to identify URLs and launch your 
web browser (like Gnome's terminal does), or use something like 
urlview to extract URLs and feed them to your web browser.

All of that is a bit of a pain, even after you have it set up. It 
would be awfully nice if mutt recognized URLs in email and allowed you 
to open them directly. For example, if mutt allowed you to open the 
first URL in an email simply by pressing 1 or the second URL simply by 
pressing 2 (while viewing that email). See what I mean?

This script can be used to (more-or-less) achieve that. When you feed 
it the body of an email (either HTML or plain text) it finds the URLs 
in it and generates a file containing some mutt macros that look 
something like this:

     macro pager 1 "<shell-command>firefox http://url1/<enter>"
     macro pager 2 "<shell-command>firefox http://url2/<enter>"
     macro pager 3 "<shell-command>firefox http://url3/<enter>"

Thus, if you tell mutt to load (i.e. "source") that file, those macros 
will be defined, and you can then launch firefox (or whatever browser 
you prefer) from mutt with a single button press.

To get this to all happen smoothly, you need to have mutt do some work 
every time you view a message: first it needs to feed the message to 
this script (which will generate that file full of macros), then it 
needs to read in that macro file. I gave some reference hooks that you 
can use to tell mutt to do that.

The next problem, logically, is it'd be nice to know (while viewing a 
message) which URLs map to which number to press, so that you know 
what to press to view the relevant URL. This script outputs a "tagged" 
version of the email. What I mean by that is that it transforms plain 
URLs:

     http://www.google.com
     http://www.yahoo.com

Into tagged ones:

     [1]http://www.google.com[1]
     [2]http://www.yahoo.com[2]

That way you know that if you press 1, mutt will launch firefox with 
the google address, and if you press 2, it will be launched with the 
yahoo address. Make sense?

~Kyle
- -- 
A wise man changes his mind, a fool never.
                                                     -- Spanish proverb
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iEYEARECAAYFAkgyKWwACgkQBkIOoMqOI14d5ACghGMNPiw/aZG2LwrGE+rAgVXy
ZeoAn1YVVyd8ZwxXkrVpBvln7o3WQ6qC
=ODLO
-----END PGP SIGNATURE-----