Gnus development mailing list
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: ding@gnus.org
Subject: Re: download attachment and do chmod for certain files
Date: Wed, 16 Dec 2020 10:00:28 -0800	[thread overview]
Message-ID: <87mtydvdfn.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87v9d2g14c.fsf@zoho.eu>

Emanuel Berg <moasenwood@zoho.eu> writes:

> Every time I get a photo (almost always a .jpg) and I get it
> from the mail location and interface to where I like it on the
> disk and with a proper filename, after that I have to do, e.g.,
> 'chmod +r photo.jpg'.
>
> How would you automate this for certain files, say *.jpg ?
>
> So basically if photo.jpg, then chmod +r photo.jpg ?
>
> Non-trivial question I guess, so extra hacker points for
> a solution :)

The "MIME Commands" part of the Gnus manual mentions the
`gnus-article-mime-part-function' variable (which holds a function) --
if you look at the description of that, the example usage is very
close to yours.

What I'm a little confused about is that this would run automatically
*every time you open the message*. This seems fairly inefficient -- I
think in normal mail usage it's very common for users to open messages
multiple times. So whatever function you wrote for that would maybe want
to check somehow if the images had already been saved.

I expected there would be some sort of "save MIME handle alist" thing
where you could have it automatically kick in when you saved an image,
but I didn't immediately see anything like that. I've studiously avoided
learning anything about Gnus' MIME handling over the years.

The other solution that comes to mind is using "pipe to part" ("K |"),
and piping the images to your own shell script that saves the image and
does the chmod.

Hope something in there is helpful.

Eric



  reply	other threads:[~2020-12-16 18:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 22:23 Emanuel Berg
2020-12-16 18:00 ` Eric Abrahamsen [this message]
2020-12-16 18:08   ` Eric Abrahamsen
2020-12-16 18:20   ` Adam Sjøgren
2020-12-16 18:33     ` Eric Abrahamsen
2020-12-18 13:19     ` Emanuel Berg
2020-12-18 21:16     ` Emanuel Berg
2020-12-18 21:49       ` Andreas Schwab
2020-12-18 22:36         ` Emanuel Berg
2020-12-18 22:55           ` Jason L Tibbitts III
2020-12-18 22:38         ` Emanuel Berg
2020-12-18 22:47           ` Emanuel Berg
2020-12-21  9:06             ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtydvdfn.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).