aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Lu2023-03-25 21:38:48 +0800
committerEli Zaretskii2023-03-26 14:41:55 +0300
commite19b7da7b09ed44bf08b06be082abdfc23d44e6f (patch)
treef8d05d672608e9627cf5817be9619ad8968ce9ff
parent564c26bdbeb1ebc1dcf00fb02d605140408a5be5 (diff)
downloademacs-e19b7da7b09ed44bf08b06be082abdfc23d44e6f.tar.gz
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)
-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
64 :version "28.1" 64 :version "28.1"
65 :type 'regexp) 65 :type 'regexp)
66 66
67(defcustom eww-default-download-directory "~/Downloads/"
68 "The default directory where downloaded files will be saved."
69 :version "30.1"
70 :group 'eww
71 :type 'string)
72
67(defun eww--download-directory () 73(defun eww--download-directory ()
68 "Return the name of the download directory. 74 "Return the name of the download directory based on the value of
69If ~/Downloads/ exists, that will be used, and if not, the 75`eww-default-download-directory'. If the specified directory exists, it
70DOWNLOAD XDG user directory will be returned. If that's 76 will be used. Otherwise, the DOWNLOAD XDG user directory will be returned."
71undefined, ~/Downloads/ is returned anyway." 77 (or (and (file-exists-p eww-default-download-directory)
72 (or (and (file-exists-p "~/Downloads/") 78 eww-default-download-directory)
73 "~/Downloads/")
74 (when-let ((dir (xdg-user-dir "DOWNLOAD"))) 79 (when-let ((dir (xdg-user-dir "DOWNLOAD")))
75 (file-name-as-directory dir)) 80 (file-name-as-directory dir))
76 "~/Downloads/")) 81 eww-default-download-directory))
77 82
78(defcustom eww-download-directory 'eww--download-directory 83(defcustom eww-download-directory 'eww--download-directory
79 "Directory where files will downloaded. 84 "Directory where files will downloaded.