On 25Apr2015 09:03, martin f krafft <[email protected]> wrote:
also sprach Cameron Simpson <[email protected]> [2015-04-25 01:24 +0200]:
I wrap all my mailcap commands with my apphelper script, which
itself is wrapped in my shorter-named "ah" script. My mailcaps
look like this:
application/pdf; ah %s -1 xpdf; gui
image/jpg; ah %s -1 xv; gui
image/tiff; ah %s -1 gm display; gui
and so forth. As you can see, the viewer is mentioned at the end.
Yeah, ah seems a nice addition to the toolchain and I might well
adopt it.
However, it does not solve the problem. I might have ah be the
default mailcap viewer, but occasionally I will want to open a PNG
file with Gimp, not the default viewer. Right now, this requires me
to save the file and invoke Gimp externally.
You can also use a shell escape to run an arbitrary _other_
command on the file.
How would you (a) get mutt to save a temporary file, using e.g. the
MIME filename or a MIME-type derived file name and then invoke some
_other_ command on the file?
apphelper already makes use of the temp file; so on the Mac where my mailcap is
woefully under configured I can just run a shell escape from apphelper.
So I go to the attachment view in mutt. Press <enter> on the attachment, which
runs apphelper (from mailcap). Here's that for a recent messages with a graph
image:
/Users/cameron/bin/apphelper: view args=[xv]
+ exec arg1 -1 -- /Users/cameron/var/mutt/Screen_Shot_2015-04-26_at_6.54.43_am.
xv
remap: /Users/cameron/rc/remap: No such file or directory
Save [/Users/cameron/bos/soup/Screen_Shot_2015-04-26_at_6.54.43_am.]? !open %
Save [/Users/cameron/bos/soup/Screen_Shot_2015-04-26_at_6.54.43_am.]?
so pressing <enter> ran apphelper which ran "xv" immediately. After quitting
"xv", I get the save prompt.
Entering "!open %" invokes the shell command "open" (standard Mac "open this
file/url with the default app" command) with the temp filename replacing the
"%".
Obviously I could issue any command, not just "open", with the filename
specified by "%".
Cheers,
Cameron Simpson <[email protected]>
manual, n.:
A unit of documentation. There are always three or more on a given item.
One is on the shelf; someone has the others.
The information you need is in the others. - Ray Simard