* Save multiple / all attachments without prompting (unless overwriting)
@ 2019-03-20 9:11 Pierre Neidhardt
2019-04-10 10:35 ` Pierre Neidhardt
0 siblings, 1 reply; 4+ messages in thread
From: Pierre Neidhardt @ 2019-03-20 9:11 UTC (permalink / raw)
To: notmuch
[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]
Is it possible to save all attachments at once to the default folder
(mm-default-directory) without prompting?
Better: only attachments in region?
So far, I've hacked around mm-decode and came up with the following:
--8<---------------cut here---------------start------------->8---
(defun mm-save-part (handle &optional prompt)
"Write HANDLE to a file.
PROMPT overrides the default one used to ask user for a file name."
(let ((filename (or (mail-content-type-get
(mm-handle-disposition handle) 'filename)
(mail-content-type-get
(mm-handle-type handle) 'name)))
file directory)
(when filename
(setq filename (gnus-map-function mm-file-name-rewrite-functions
(file-name-nondirectory filename))))
(setq file mm-default-directory) ; <- ONLY CHANGE
(if (file-directory-p file)
(setq file (expand-file-name filename file))
(setq file (expand-file-name
file (or mm-default-directory default-directory))))
(setq mm-default-directory (file-name-directory file))
(and (or (not (file-exists-p file))
(yes-or-no-p (format "File %s already exists; overwrite? "
file)))
(progn
(mm-save-part-to-file handle file)
file))))
--8<---------------cut here---------------end--------------->8---
Thoughts?
--
Pierre Neidhardt
https://ambrevar.xyz/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Save multiple / all attachments without prompting (unless overwriting)
2019-03-20 9:11 Save multiple / all attachments without prompting (unless overwriting) Pierre Neidhardt
@ 2019-04-10 10:35 ` Pierre Neidhardt
2019-04-10 12:37 ` David Edmondson
0 siblings, 1 reply; 4+ messages in thread
From: Pierre Neidhardt @ 2019-04-10 10:35 UTC (permalink / raw)
To: notmuch
[-- Attachment #1: Type: text/plain, Size: 67 bytes --]
Ping! :)
Anyone?
--
Pierre Neidhardt
https://ambrevar.xyz/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Save multiple / all attachments without prompting (unless overwriting)
2019-04-10 10:35 ` Pierre Neidhardt
@ 2019-04-10 12:37 ` David Edmondson
2019-04-10 13:21 ` Pierre Neidhardt
0 siblings, 1 reply; 4+ messages in thread
From: David Edmondson @ 2019-04-10 12:37 UTC (permalink / raw)
To: Pierre Neidhardt, notmuch
On Wednesday, 2019-04-10 at 12:35:37 +02, Pierre Neidhardt wrote:
> Ping! :)
> Anyone?
Nothing currently available does it.
You might be able to avoid mm altogether and go direct to notmuch to
save the parts, which might make things a bit easier to control from the
front end.
Iterate over the buttons in the region, examining them to see if they
are attachments, then provoke the 'save' method (which might need some
surgery to use a default directory and avoid prompting).
dme.
--
You're like my yo-yo, that glowed in the dark.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-10 13:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-20 9:11 Save multiple / all attachments without prompting (unless overwriting) Pierre Neidhardt
2019-04-10 10:35 ` Pierre Neidhardt
2019-04-10 12:37 ` David Edmondson
2019-04-10 13:21 ` Pierre Neidhardt
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
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 read-only IMAP folder(s) and NNTP newsgroup(s).