branch: externals/svg-lib commit 6ceae8324723523428b2a006056690b52aee7fbe Author: Damon Chan <damon.c...@freshup.com.hk> Commit: Damon Chan <damon.c...@freshup.com.hk>
Change `svg-lib-icons-dir` default value It saves to "~/.emacs.d/.cache/svg-lib/" by default. If `svg-lib-icons-dir` does not exist, create it. --- svg-lib.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/svg-lib.el b/svg-lib.el index 682916a..40fc697 100644 --- a/svg-lib.el +++ b/svg-lib.el @@ -103,7 +103,8 @@ collection (there are way too many to store them)." :value-type (string :tag "URL")) :group 'svg-lib) -(defcustom svg-lib-icons-dir "~/Downloads" +(defcustom svg-lib-icons-dir + (expand-file-name (concat user-emacs-directory ".cache/svg-lib/")) "svg-lib icons directory." :group 'svg-lib :type 'directory) @@ -313,7 +314,9 @@ Cached version is returned if it exists unless FORCE-RELOAD is t." ;; Build url from collection and name without checking for error (let ((url (format (cdr (assoc collection svg-lib-icon-collections)) name))) - ;; Get data from cache + ;; create the svg-lib-icons-dir if not exists + (unless (file-exists-p svg-lib-icons-dir) + (make-directory svg-lib-icons-dir)) (let* ((filename (expand-file-name (format "%s_%s.svg" collection name) svg-lib-icons-dir)) (buffer (if (or force-reload (not (file-exists-p filename))) (with-current-buffer (url-retrieve-synchronously url)