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

Attachment: signature.asc
Description: PGP signature

Reply via email to