summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorXi Lu <lx@shellcodes.org>2023-03-25 21:38:48 +0800
committerEli Zaretskii <eliz@gnu.org>2023-03-26 14:41:55 +0300
commite19b7da7b09ed44bf08b06be082abdfc23d44e6f (patch)
treef8d05d672608e9627cf5817be9619ad8968ce9ff /lisp/net
parent564c26bdbeb1ebc1dcf00fb02d605140408a5be5 (diff)
downloademacs-e19b7da7b09ed44bf08b06be082abdfc23d44e6f.tar.gz
emacs-e19b7da7b09ed44bf08b06be082abdfc23d44e6f.tar.bz2
emacs-e19b7da7b09ed44bf08b06be082abdfc23d44e6f.zip
Add 'eww-default-download-directory'.
* lisp/net/eww.el (eww-default-download-directory): New defcustom. (eww--download-directory): Use it. (Bug#62435)
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/eww.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 859a9b44bcb..9552138bb6e 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -64,16 +64,21 @@ The action to be taken can be further customized via
:version "28.1"
:type 'regexp)
+(defcustom eww-default-download-directory "~/Downloads/"
+ "The default directory where downloaded files will be saved."
+ :version "30.1"
+ :group 'eww
+ :type 'string)
+
(defun eww--download-directory ()
- "Return the name of the download directory.
-If ~/Downloads/ exists, that will be used, and if not, the
-DOWNLOAD XDG user directory will be returned. If that's
-undefined, ~/Downloads/ is returned anyway."
- (or (and (file-exists-p "~/Downloads/")
- "~/Downloads/")
+ "Return the name of the download directory based on the value of
+`eww-default-download-directory'. If the specified directory exists, it
+ will be used. Otherwise, the DOWNLOAD XDG user directory will be returned."
+ (or (and (file-exists-p eww-default-download-directory)
+ eww-default-download-directory)
(when-let ((dir (xdg-user-dir "DOWNLOAD")))
(file-name-as-directory dir))
- "~/Downloads/"))
+ eww-default-download-directory))
(defcustom eww-download-directory 'eww--download-directory
"Directory where files will downloaded.