branch: elpa/elfeed
commit 57f94d408258a4f07122a39a327283b3dd597a9a
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
elfeed--download-enclosure: Use curl directly if elfeed-use-curl is enabled
Remove soft dependency on async.el.
Fix #322
---
elfeed-show.el | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/elfeed-show.el b/elfeed-show.el
index a77b3f5f1b..49f5896148 100644
--- a/elfeed-show.el
+++ b/elfeed-show.el
@@ -375,14 +375,21 @@ All attachments are saved in the chosen directory."
(defun elfeed--download-enclosure (url path)
"Download asynchronously the enclosure from URL to PATH."
- (if (require 'async nil :noerror)
- (with-no-warnings
- (async-start
- (lambda ()
- (url-copy-file url path t))
- (lambda (_)
- (message "%s downloaded" url))))
- (url-copy-file url path t)))
+ (if elfeed-use-curl
+ (make-process
+ :name "elfeed-curl"
+ :command
+ (list elfeed-curl-program-name
+ "--disable" "--fail" "--location" "--silent"
+ "--user-agent" elfeed-user-agent "-o" (expand-file-name path)
+ url)
+ :sentinel
+ (lambda (_proc status)
+ (if (string-prefix-p "finished" status)
+ (message "Enclosure download %s finished (%s)" path url)
+ (message "Enclosure download %s failed (%s)" path url))))
+ (url-copy-file url path t))
+ nil)
(defun elfeed--get-enclosure-num (prompt entry &optional multi)
"Ask the user with PROMPT for an enclosure number for ENTRY.