From 9d60ec71260f627940d179e3bd559014b6c5a15d Mon Sep 17 00:00:00 2001 From: Nick Drozd Date: Sat, 2 Feb 2019 12:35:02 -0600 Subject: [PATCH 2/3] eww-download: Use link under point or current URL * lisp/net/eww.el (eww-download) * doc/misc/eww.texi (Basics) --- doc/misc/eww.texi | 7 ++++--- lisp/net/eww.el | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 088da6f5fe..79175d10a9 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -125,9 +125,10 @@ Basics @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 3b7d9d5c2f..0c8bffa579 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1531,10 +1531,12 @@ eww-copy-page-url (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))))) -- 2.17.1