On Fri, Jan 25, 2013 at 12:26:11PM -0500, Mark H. Wood wrote: [cut] > > Second(personal issue): I'm still having problems with > > getting my html-mail to open(in a new tab) in my browser, > > which is Firefox(Debianers call it iceweasel). Often, > > when I use 'v' on an entry in my mutt display, and then > > Arrow down to "3 . . . . [text/html . . . .", and then > > press Enter, a new Tab does open in my browser, and I see > > the html-mail displayed nicely. Even then I get, in my > > browser-Tab: "file:///home/alan/tmp/mutt.html", but there > > is no such file in my ~/tmp directory! > > > > But, too often, I get a quick new tab, a tenth of a second > > look at the html I want to see, and then mutt "thinks better > > of it" and I get a screen: > > File not found Iceweasel can't find the file at > > /home/alan/tmp/mutt.html > > > > The decision which way mutt will go between these two > > alternatives is, as far as I can see, quite arbitrary. > > You probably need to add "; needsterminal" to your .mailcap entry for > "text/html" so that Mutt will ask you to hit a key when the external > program (Iceweasel) is finished. For more on .mailcap and how Mutt > interprets it, see: > > http://www.mutt.org/doc/manual/manual-5.html > > especially the section "Optional Fields". > > Background: > > This sounds like what is usually called a "race condition". Two > processes are trying to use the same resource without sufficient > coordination. Some times one process completes first, other times the > other completes first. This causes differing behavior at different > times. > > Here, I expect that Mutt is writing out that temporary file, invoking > Iceweasel, and then cleaning up the temporary file without concerning > itself with whether Iceweasel has had time to start itself and open > the file. If Iceweasel already has the file open, then Mutt can > delete it now and it will go away when Iceweasel closes it. Otherwise > Iceweasel goes to open the file it was told to show, and the file is > not there, because it was already deleted by Mutt. > > There are at least two ways to cure a race. The simple one is to get > one process to wait for the other to finish, or at least fully start. > The more complex (but preferred if it is not too difficult) way is to > have the processes tell each other how they're proceeding so that each > can make good decisions. The simple way here is to get Mutt to wait > until you tell it to proceed.
third one, less scientific but "it works most of the times": add the following lines to your ~/.mailcap text/html; sensible-browser %s & sleep 2; nametemplate=%s.html text/html; w3m -I %{charset} -T text/html -dump %s; print=w3m -I %{charset} -T text/html -dump %s; nametemplate=%s.html; copiousoutput you can substitute sensible-browser with iceweasel or firefox. I don't remember why I did not set the test field on the first line: test=sh -c 'test $DISPLAY'