[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 51e6e06 1/2: Download of URL in EWW falls back on c
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master 51e6e06 1/2: Download of URL in EWW falls back on current URL |
Date: |
Fri, 8 Feb 2019 02:54:30 -0500 (EST) |
branch: master
commit 51e6e0694acb6ecb54962d702193ec5b21e57128
Author: Nick Drozd <address@hidden>
Commit: Eli Zaretskii <address@hidden>
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.
---
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 b299ea1..3048893 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 3b7d9d5..0c8bffa 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)))))