aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Drozd2019-02-02 12:35:02 -0600
committerEli Zaretskii2019-02-08 09:45:19 +0200
commit51e6e0694acb6ecb54962d702193ec5b21e57128 (patch)
tree2ad35c9a126b6c0b52094683609d11421c2817cc
parentdbb1a8bc1a285c7ed8817bac533ed4a096c391ac (diff)
downloademacs-51e6e0694acb6ecb54962d702193ec5b21e57128.tar.gz
emacs-51e6e0694acb6ecb54962d702193ec5b21e57128.zip
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.
-rw-r--r--doc/misc/eww.texi7
-rw-r--r--lisp/net/eww.el6
2 files changed, 8 insertions, 5 deletions
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.
125@vindex eww-download-directory 125@vindex eww-download-directory
126@kindex d 126@kindex d
127@cindex Download 127@cindex Download
128 A URL under the point can be downloaded with @kbd{d} 128 A URL can be downloaded with @kbd{d} (@code{eww-download}). This
129(@code{eww-download}). The file will be written to the directory 129will download the link under point if there is one, or else the URL of
130specified in @code{eww-download-directory} (Default: @file{~/Downloads/}). 130the current page. The file will be written to the directory specified
131in @code{eww-download-directory} (default: @file{~/Downloads/}).
131 132
132@findex eww-back-url 133@findex eww-back-url
133@findex eww-forward-url 134@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."
1531 (kill-new (plist-get eww-data :url))) 1531 (kill-new (plist-get eww-data :url)))
1532 1532
1533(defun eww-download () 1533(defun eww-download ()
1534 "Download URL under point to `eww-download-directory'." 1534 "Download URL to `eww-download-directory'.
1535Use link under point if there is one, else the current page URL."
1535 (interactive) 1536 (interactive)
1536 (access-file eww-download-directory "Download failed") 1537 (access-file eww-download-directory "Download failed")
1537 (let ((url (get-text-property (point) 'shr-url))) 1538 (let ((url (or (get-text-property (point) 'shr-url)
1539 (eww-current-url))))
1538 (if (not url) 1540 (if (not url)
1539 (message "No URL under point") 1541 (message "No URL under point")
1540 (url-retrieve url 'eww-download-callback (list url))))) 1542 (url-retrieve url 'eww-download-callback (list url)))))