summaryrefslogtreecommitdiff
path: root/fussy.el
diff options
context:
space:
mode:
Diffstat (limited to 'fussy.el')
-rw-r--r--fussy.el37
1 files 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