.muttrc: Accessing attachment filename and quoting
Kevin J. McCarthy
kevin at 8t8.us
Fri Aug 25 16:03:54 UTC 2023
On Thu, Aug 24, 2023 at 05:10:39PM +0200, Orm Finnendahl wrote:
>Hi,
>
> 1. I try to write a macro allowing to open an attachment with another
> than the default program. Is there a way to refer to the filename
> of the attachment in the macro definition (like the %s in
> mailcap)?
No. You might play around with the `test=<command>` field in the
mailcap and see if you can use that somehow. For example, one idea
(untested) would be using setenv in the macro around the attachment
opening:
macro ,a '<enter-command>setenv ATTPROGRAM foo<enter><view-mailcap><enter-command>unsetenv ATTPROGRAM<enter>'
macro ,b '<enter-command>setenv ATTPROGRAM bar<enter><view-mailcap><enter-command>unsetenv ATTPROGRAM<enter>'
And in your .mailcap
application/baz; fooprogram %s; test=test x$ATTPROGRAM = xfoo
application/baz; barprogram %s; test=test x$ATTPROGRAM = xbar
...
application/baz; defaultprogram %s
> 2. When piping an attachment to an external program, filenames with
> spaces don't work. is there a way to enclose the filename with
> quotes before submitting it to the pipe?
You'll have to be more specific about what you are doing and how it's
failing.
--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.mutt.org/pipermail/mutt-users/attachments/20230826/cc16d262/attachment.asc>
More information about the Mutt-users
mailing list