Re: .muttrc: Accessing attachment filename and quoting

2023-08-25 Thread Kevin J. McCarthy

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=` 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 'setenv ATTPROGRAM 
foounsetenv ATTPROGRAM'
macro ,b 'setenv ATTPROGRAM 
barunsetenv ATTPROGRAM'

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


signature.asc
Description: PGP signature


.muttrc: Accessing attachment filename and quoting

2023-08-24 Thread Orm Finnendahl
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)?

 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?

--
Orm