Function: eww-download

eww-download is an interactive and byte-compiled function defined in eww.el.gz.

Signature

(eww-download)

Documentation

Download a Web page to eww-download-directory.

Use link at point if there is one, else the current page's URL. This command downloads the page to the download directory, under a file name generated from the last portion of the page's URL, after the last slash. (If URL ends in a slash, the page will be saved under the name "!".) If there's already a file by that name in the download directory, this command will modify the name to make it unique. The command shows in the echo-area the actual file name where the page was saved.

Probably introduced at or before Emacs version 27.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/net/eww.el.gz
(defun eww-download ()
  "Download a Web page to `eww-download-directory'.
Use link at point if there is one, else the current page's URL.
This command downloads the page to the download directory, under
a file name generated from the last portion of the page's URL,
after the last slash.  (If URL ends in a slash, the page will be
saved under the name \"!\".)
If there's already a file by that name in the download directory,
this command will modify the name to make it unique.
The command shows in the echo-area the actual file name where the
page was saved."
  (interactive nil eww-mode)
  (let ((dir (if (stringp eww-download-directory)
                 eww-download-directory
               (funcall eww-download-directory))))
    (access-file dir "Download failed")
    (let ((url (or (get-text-property (point) 'shr-url)
                   (eww-current-url))))
      (if (not url)
          (message "No URL under point")
        (url-retrieve url #'eww-download-callback (list url dir))))))