diff --git a/mu4e/mu4e-vars.el b/mu4e/mu4e-vars.el index f860fd89..a2910aa8 100644 --- a/mu4e/mu4e-vars.el +++ b/mu4e/mu4e-vars.el @@ -118,8 +118,7 @@ better with e.g. offlineimap." "Default directory for saving attachments. This can be either a string (a file system path), or a function that takes a filename and the mime-type as arguments, and returns -the attachment dir. See Info node `(mu4e) Opening and saving -attachments' for details." +the attachment dir. See Info node `(mu4e) Attachments' for details." :type 'directory :group 'mu4e :safe 'stringp) diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 01497001..198082d8 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -687,6 +687,11 @@ FUNC should be a function taking two arguments: '("Open attachment" . mu4e-view-open-attachment)) (define-key menumap [extract-att] '("Extract attachment" . mu4e-view-save-attachment)) + + (define-key menumap [save-url] + '("Save URL to kill-ring" . mu4e-view-save-url)) + (define-key menumap [fetch-url] + '("Fetch URL" . mu4e-view-fetch-url)) (define-key menumap [goto-url] '("Visit URL" . mu4e-view-go-to-url)) @@ -1381,6 +1386,18 @@ to save a range of URLs." (kill-new url) (mu4e-message "Saved %s to the kill-ring" url)))) +(defun mu4e-view-fetch-url (&optional multi) + "Offer to fetch (download) urls(s). If MULTI (prefix-argument) is nil, +download a single one, otherwise, offer to fetch a range of +URLs. The urls are fetched to `mu4e-attachment-dir'." + (interactive "P") + (mu4e~view-handle-urls "URL to fetch" multi + (lambda (url) + (let ((target (concat (mu4e~get-attachment-dir url) "/" + (file-name-nondirectory url)))) + (url-copy-file url target) + (mu4e-message "Fetched %s -> %s" url target))))) + (defun mu4e~view-handle-urls (prompt multi urlfunc) "If MULTI is nil, apply URLFUNC to a single uri, otherwise, apply it to a range of uris. PROMPT is the query to present to the user." diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index 138ca6e9..eb2c1e6b 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -1173,6 +1173,8 @@ actions g go to (visit) numbered URL (using `browse-url') (or: or M-RET with point on url) C-u g visits multiple URLs +f fetch (download )the numbered URL. +C-u f fetches multiple URLs k save the numbered URL in the kill-ring. C-u k saves multiple URLs