Re: Script to find list email at gmane.org
On date Saturday 2006-11-25 13:36:30 +0000, Michael Williams muttered:
> Hi,
>
> I like to bookmark useful mailing list threads in my web browser using
> the web archive provided by the HTTP/NTTP/mailing list gateway
> gmane.org. I've written this very simple shell script which I call from
> within mutt using a macro to pull up the email in gmane.
>
> #!/bin/sh
>
> GMANE="http://mid.gmane.org/"
> MESSAGEID=`grep "^Message-ID:" - | head -1`
> MESSAGEID=`echo $MESSAGEID | sed 's/^.*<//' | sed 's/>$//'`
> URL="$GMANE$MESSAGEID"
> open $URL
>
> It uses Mac OS X's extremely useful "open" command, which accepts URLs
> or files as its argument, with an optional application. If no
> application is specified (as here) it uses the default handler for that
> URL/file. In this case, it launches the default web browser.
>
> macro index G '<pipe-message> ~/.mutt/gmaneview.sh'\n 'view list message in
> gmane'
> macro pager G '<pipe-message> ~/.mutt/gmaneview.sh'\n 'view list message in
> gmane'
>
> Known problems
> --------------
>
> The last line must be modified to work on platforms other than OS X. I
> tried "firefox $URL", which works if Firefox is already open, but fails
> to return control to the shell if it isn't, i.e. I didn't get "Press a
> key to continue..." until I closed that instance of Firefox. It is also
> not useful if the user uses a browser other than Firefox (information I
> understand is available through the alternatives system in Debian-like
> Linuxes).
Suggestions:
1) xdg-open in xdg-utils (tryies to detect which DE
instance if any is running and launch a corresponding DE open utility
(gnome-open, kde-open, xfce-open), if doesn't find anyone uses
run-mailcap). It doesn't support url/uri.
2) fish (friendly interactive shell) has an internal command named open
that opens a given file according to the file type and mailcap. I
don't know if it supports url/uri.
I'm not sure about the file detection method they use (maybe they use
both the "file" utility). It shouldn't be too difficult to extend the
functionality of run-mailcap to support uri (see for example the
mutt-url script).
HTH
Cheers
--
Stefano Sabatini
Linux user number 337176 (see http://li.count.org)