   :type 'boolean
   :group 'elfeed)
 
+(defvar elfeed-show-enclosure-filename-function
+  #'elfeed-show-enclosure-filename-remote
+  "Function called to generate the filename for an enclosure.")
+
 (defun elfeed--download-enclosure (url path)
   "Download asynchronously the enclosure from URL to PATH."
   (if (require 'async nil :noerror)

                               "Enclosure to save" entry)))
         (url-enclosure (car (elt (elfeed-entry-enclosures entry)
                                  (- enclosure-index 1))))
         (fname (file-name-nondirectory
                 (url-unhex-string
                  (car (url-path-and-query (url-generic-parse-url
                                            url-enclosure))))))
         (retry t)
         (fpath))
    (while retry

    (if (file-directory-p fpath)
        fpath)))

(defun elfeed-show-enclosure-filename-remote (_entry url-enclosure)
  "Returns the remote filename as local filename for an enclosure."
  (file-name-nondirectory
   (url-unhex-string
    (car (url-path-and-query (url-generic-parse-url
                              url-enclosure))))))

(defun elfeed-show-save-enclosure-single (&optional entry enclosure-index)
  "Save enclosure number ENCLOSURE-INDEX from ENTRY.
If ENTRY is nil use the elfeed-show-entry variable.
