From cffc938f28c3ec3a55851cb198fc2448f58fdc2e Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 28 Mar 2023 19:37:25 -0700 Subject: theme images are stored under root/package/theme/images.svg --- fussy.el | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/fussy.el b/fussy.el index 9508661..20680db 100644 --- a/fussy.el +++ b/fussy.el @@ -35,6 +35,24 @@ called filename." (error (push (cl-first theme) failed-to-install)))) failed-to-install)) +(defun locate-theme-package (theme) + "Given a symbol naming a theme, find the name of the package that +the theme came from." + (let ((theme-file + (locate-file (concat (symbol-name theme) "-theme.el") + (custom-theme--load-path) + '("" "c")))) + (string-join + (butlast + (split-string + (second + (reverse + (file-name-split + (file-name-directory + theme-file)))) + "-")) + "-"))) + (defun fussy-generate-all-theme-images (&rest files) (let ((failed-to-load nil) (failed-to-generate-image nil) @@ -50,14 +68,17 @@ called filename." (message "... failed to load!") nil)) (dolist (file files) - (let ((svg-file - (concat - (getenv "HOME") "/" - (symbol-name theme) "/" - (file-name-base file) - "." - (file-name-extension file) - ".svg"))) + (let* ((theme-package + (locate-theme-package theme)) + (svg-file + (concat + (getenv "HOME") "/" + theme-package "/" + (symbol-name theme) "/" + (file-name-base file) + "." + (file-name-extension file) + ".svg"))) (make-directory (file-name-directory svg-file) t) (condition-case nil (progn -- cgit v1.2.3