From: Nick Drozd Date: Sat, 2 Feb 2019 18:35:02 +0000 (-0600) Subject: Download of URL in EWW falls back on current URL X-Git-Tag: emacs-27.0.90~3651 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=51e6e0694acb6ecb54962d702193ec5b21e57128;p=emacs.git Download of URL in EWW falls back on current URL * lisp/net/eww.el (eww-download): If there's no URL at point, download the current URL instead. Previous behavior was to signal an error if there was no URL at point. (Bug#34291) * doc/misc/eww.texi (Basics): Update documentation. --- diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index b299ea1fb77..3048893372e 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -125,9 +125,10 @@ HTML-specified colors or not. This sets the @code{shr-use-colors} variable. @vindex eww-download-directory @kindex d @cindex Download - A URL under the point can be downloaded with @kbd{d} -(@code{eww-download}). The file will be written to the directory -specified in @code{eww-download-directory} (Default: @file{~/Downloads/}). + A URL can be downloaded with @kbd{d} (@code{eww-download}). This +will download the link under point if there is one, or else the URL of +the current page. The file will be written to the directory specified +in @code{eww-download-directory} (default: @file{~/Downloads/}). @findex eww-back-url @findex eww-forward-url diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 3b7d9d5c2f9..0c8bffa579b 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1531,10 +1531,12 @@ Differences in #targets are ignored." (kill-new (plist-get eww-data :url))) (defun eww-download () - "Download URL under point to `eww-download-directory'." + "Download URL to `eww-download-directory'. +Use link under point if there is one, else the current page URL." (interactive) (access-file eww-download-directory "Download failed") - (let ((url (get-text-property (point) 'shr-url))) + (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)))))