aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Oteiza2017-01-28 12:06:41 -0500
committerMark Oteiza2017-01-28 12:06:41 -0500
commitc7bbddf0eae653b23430c426cb75e0289e9f3a29 (patch)
tree0be882e19ba442a05a50e7d6a7558af82cef87c5
parentf83363d30e1c78c228e57fe1a5e9ad8faf89f238 (diff)
downloademacs-c7bbddf0eae653b23430c426cb75e0289e9f3a29.tar.gz
emacs-c7bbddf0eae653b23430c426cb75e0289e9f3a29.zip
Use access-file in EWW to check before downloading a file
* lisp/net/eww.el (eww-download): Check accessibility of eww-download-directory to prevent starting a download that will fail to write. * src/fileio.c (Faccess_file): Clarify the use of string argument in the docstring.
-rw-r--r--lisp/net/eww.el1
-rw-r--r--src/fileio.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 0282fe68e6a..f7e06341443 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1501,6 +1501,7 @@ Differences in #targets are ignored."
1501(defun eww-download () 1501(defun eww-download ()
1502 "Download URL under point to `eww-download-directory'." 1502 "Download URL under point to `eww-download-directory'."
1503 (interactive) 1503 (interactive)
1504 (access-file eww-download-directory "Download failed")
1504 (let ((url (get-text-property (point) 'shr-url))) 1505 (let ((url (get-text-property (point) 'shr-url)))
1505 (if (not url) 1506 (if (not url)
1506 (message "No URL under point") 1507 (message "No URL under point")
diff --git a/src/fileio.c b/src/fileio.c
index 81eaa771189..a46cfc7ac69 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2682,7 +2682,7 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
2682 2682
2683DEFUN ("access-file", Faccess_file, Saccess_file, 2, 2, 0, 2683DEFUN ("access-file", Faccess_file, Saccess_file, 2, 2, 0,
2684 doc: /* Access file FILENAME, and get an error if that does not work. 2684 doc: /* Access file FILENAME, and get an error if that does not work.
2685The second argument STRING is used in the error message. 2685The second argument STRING is prepended to the error message.
2686If there is no error, returns nil. */) 2686If there is no error, returns nil. */)
2687 (Lisp_Object filename, Lisp_Object string) 2687 (Lisp_Object filename, Lisp_Object string)
2688{ 2688{