On Sun, Aug 30, 2009 at 04:22:03PM -0400, Thomas Baker wrote:
> I use mutt with Cygwin and Windows XP.

Your problems are unrelated to mutt and would be more appropriate on the
Cygwin mailing list and/or Firefox forums.  But out of sympathy and
because the underlying *nix/Windows questions tend not to fall into any
single category, I'll try to answer the questions you've already asked and
beg everyone's indulgence, or at least hope no one notices or complains.
;-)

> Until Firefox release 2.0.0.12, I very happily used the plug-in MIME
> Edit [1] to associate the extension ".mbox" with a batch file,
> mbox.bat:

I'd recommend you start first with investigating one of the
network.protocol-handler settings made available in about:config.
 
>     ============================================================
>     @echo off
>     c:\cygwin\bin\bash.exe -i e:\u\config\mbox.sh "%1"
>     ============================================================

Ugh.  And if the value passed to mbox.sh is 

  C:\Documents and Settings\Thomas Baker\Mail\some.mbox

you expect mutt to do what? 

Aside from being ugly and unmanageable. there's generally no reason to
write DOS batch files or use per-application wrapper scripts as Cygwin
provides you with more sane alternatives, none of which are plagued by
the file association nonsense and the lack of a meaningful path that
Windows traditionally suffers from.  Assuming you had the foresight when
installing Cygwin to add the Windows equivalent of /c/Cygwin/bin and
~/bin to your path (Start -> Run -> sysdm.cpl -> Advanced / Environment
Variables), and you have ~/.Xdefaults configured (irrespective of
whether you're running X), the following would be preferrable

rxvt -e mutt -f /path/to/mbox
rxvt -e bash
bash -c /path/to/script
perl ...
python ...

Each of the above could be used most anywhere a regular Windows command
or program is used (the 'Start -> Run' dialog, for example), and if the
full Windows-style path to the first program called is provided,
everywhere else (shortcuts, configurable menu or toolbar items,
registry, etc.).

As a side note, on Windows, installed programs (third-party utilities,
GUI programs, etc.) are rarely in your path, so be sure to symlink any
or all of them into some place like ~/bin, giving them meaningful names
(preferrably lowercase and without .EXE extensions) in the process.

The ugly exception to all this harmony occurs when you're mixing Cygwin
and Windows programs and need to reference a path other than the current
working directory.  Cygwin programs require Unix paths, and Windows
programs require Windows paths.  In the registry, DOS files, etc., any
%1 %2 ... arguments that end up being passed to a Cygwin program must be
converted to a Unix-style path *before* the program receives it (modulo
cd tricks); the inverse is also true.  See below for my solution.

> which ran mbox.sh - essentially:
> 
>     ============================================================
>     #!/bin/bash
>     mutt -F /home/tbaker/u/config/muttrc/muttrc -f "$1"
>     ============================================================
>
> So that when I clicked on a link such as:
> 
>     ============================================================
>     <a href="file://localhost/e:/foo/bar.mbox">Foobar</a>
>     ============================================================
> 
> in Firefox, it would run mutt, opening the mailbox bar.mbox.  It
> was fantastic!

If you say so.  ;-)

> With Firefox 3, I can use a "patched" version of [1] (see [2])
> to associate the extension ".mbox" with mbox.bat, as before --
> only this time it does not work.  When I click on a link, nothing
> happens.
> 
> This is perhaps ultimately a Firefox issue, having to do perhaps
> with the way arguments are passed.  

What I would do is configure mime edit or Firefox to use the "default
associations".  To create those default associations so that you can
click away on URLs that reference mbox files (i.e., have an '.mbox'
extension) or whatever it is you're trying to do, you can use the
following working but minimal regfile:

---------cut here------------------------
Windows Registry Editor Version 5.00

; Associate .mbox extension with rxvt -e mutt (without batch files
; or wrappers), using run(1) to deal with cmd.exe window issues.

[HKEY_CLASSES_ROOT\.mbox]
@="mboxfile"

[HKEY_CLASSES_ROOT\mboxfile]

[HKEY_CLASSES_ROOT\mboxfile\shell]

[HKEY_CLASSES_ROOT\mboxfile\shell\open]

[HKEY_CLASSES_ROOT\mboxfile\shell\open\command]
@="c:\\cygwin\\bin\\run.exe bash --login -c \"rxvt -e mutt -f \\\"`cygpath -u 
'%1'`\\\"\""
---------cut here------------------------

Mind the wordwrap, and save the file with DOS line-endings.

> I'm raising the issue on this list because I'm thinking there must be
> people out there who also really want to run mutt from within
> Firefox...

You'd probably be wrong. If you don't regularly keep a terminal window
open or are otherwise typing averse, I'd suggest a Windows desktop
shortcut configured with 'c:\cygwin\bin\rxvt.exe -e mutt' would be a
better solution.  Note that while I'm repeatedly advocating rxvt to
replace cmd.exe (which is slow, clumsy to use and featureless), feel
free to substitute rxvt with something like mintty.

Don't know if any of the above will solve your immediate problem, but if
it helps you understand things better, or more importantly, aids in your
enjoyment of using mutt, then that's A Good Thing.

-- 
George

Reply via email to