[notmuch] [PATCH 2/2] Save all attachments to a directory

Carl Worth cworth at cworth.org
Thu Dec 10 16:57:01 PST 2009


On Sat,  5 Dec 2009 14:54:00 -0800, Keith Amidon <keith at nicira.com> wrote:
> Prompt for a directory and write all attachments of the current
> message to that directory, prompting for a filename for each with a
> default value of the filename specified in the attachment.

I really like the idea of this function. I'd just like to see a few,
little improvements.

> The behavior of this function differs in two ways from the existing
> notmuch-show-save-attachments function:

First, I'm not sure whether we need two different variations of what's
effectively the same operation here ("save all attachments").

What I would like is one command to save a single attachment, and then
one command to save all attachments. So if we assume that the current
'w' keybinding is really for "write one attachment" (with a lame
implementation currently), and 'W' is for "write all attachments", then
I think I'd be OK with that.

As for the changes we need here, the prompting for the directory needs
a string telling the user what's being prompted for. Something like
"Save all attachments to: ", which should just be another argument to
the interactive call, right?

Second, the command needs to provide a little bit of feedback as to what
was saved. I ended up running this command a couple of times before I
realized it was never going to save the inline patch with no filename
that I was looking at[*].

So it at least needs to message something like "N files written to DIR"
or so.

Should be fairly trivial improvements to the current patch I think.

-Carl

[*] So there's something else I think we need here. I was seeing a patch
in a message, but wanted to get it into a file before piping it off to
something, (so '|' didn't work). The patch wasn't an attachment so 'w'
didn't work as described above. I tried using 'V' to view the raw
message, but then found that the MIME part I wanted was actually encoded
as quoted-printable, so just saving the raw message wasn't useful
either.

So do we need a command to write the current "cooked" message to a file?
I suppose I could have just used:

	| cat > /some/filename

but that feels a little bit like cat abuse.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091210/5f61d87f/attachment.pgp>


More information about the notmuch mailing list