summaryrefslogtreecommitdiff
path: root/fussy.el
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2023-03-29 07:50:04 -0700
committercolin <colin@cicadas.surf>2023-03-29 07:50:04 -0700
commit79f50376dd6c8be902392f25aaa1e7e0ff75d6b2 (patch)
treed4d7ef37231e54bface572445e2d7a7679e5e64b /fussy.el
parentba58d9657a42b9a922e2663faadf0d6eb824040e (diff)
Restricting installs and theme loads in fussy.el
Diffstat (limited to 'fussy.el')
-rw-r--r--fussy.el81
1 files changed, 50 insertions, 31 deletions
diff --git a/fussy.el b/fussy.el
index 654594d..7049ee2 100644
--- a/fussy.el
+++ b/fussy.el
@@ -16,7 +16,23 @@
(not (cl-member (cl-first pkg-entry) +excluded-package-names+)))))
(defun fussy-themes-packages ()
- (cl-remove-if-not 'fussy-is-theme-p package-archive-contents))
+ "Setting FUSSY-THEME-PACKAGES-TO-LOAD at the command line will
+restrict the package installation step to just these
+packages. This function checks that FUSSY-THEME-PACKAGES-TO-LOAD
+is bound and if it is, returns it, otherwise, it filters all
+theme packages from the PACKAGE-ARCHIVE-CONTENTS and returns
+those."
+ (if (boundp 'fussy-theme-packages-to-load)
+ fussy-theme-packages-to-load
+ (cl-remove-if-not 'fussy-is-theme-p package-archive-contents)))
+
+(defun fussy-themes-to-exclude-from-image-generation ()
+ "Setting FUSSY-EXCLUDED-THEMES from the command line will tell
+the script not to load those themes. This function simply checks
+that the variable is bound and returns its value, a list of
+symbols, returning nil if not."
+ (when (boundp 'fussy-excluded-themes)
+ fussy-excluded-themes))
(defun fussy-screenshot-svg (filename)
"Save a screenshot of the current frame as an SVG image to a file
@@ -30,9 +46,10 @@ called filename."
(defun install-all-themes ()
(let ((failed-to-install nil))
(cl-dolist (theme (fussy-themes-packages))
- (condition-case nil
- (package-install (cl-first theme))
- (error (push (cl-first theme) failed-to-install))))
+ (let ((package-name (if (symbolp theme) theme (cl-first theme))))
+ (condition-case nil
+ (package-install package-name)
+ (error (push package-name failed-to-install)))))
failed-to-install))
(defun locate-theme-package (theme)
@@ -59,33 +76,34 @@ the theme came from."
(failed-to-install (install-all-themes)))
(message "All themes have been loaded")
(cl-dolist (theme (custom-available-themes))
- (message (format "Generating for theme: %s" theme))
- (unwind-protect
- (when (condition-case nil
- (progn (load-theme theme t)
- t)
- (error (push theme failed-to-load)
- (message "... failed to load!")
- nil))
- (dolist (file files)
- (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
- (find-file file)
- (delete-other-windows)
- (fussy-screenshot-svg svg-file))
- (error (push (cons theme file) failed-to-generate-image)))))))
+ (unless (member theme (fussy-themes-to-exclude-from-image-generation))
+ (message (format "Generating for theme: %s" theme))
+ (unwind-protect
+ (when (condition-case nil
+ (progn (load-theme theme t)
+ t)
+ (error (push theme failed-to-load)
+ (message "... failed to load!")
+ nil))
+ (dolist (file files)
+ (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
+ (find-file file)
+ (delete-other-windows)
+ (fussy-screenshot-svg svg-file))
+ (error (push (cons theme file) failed-to-generate-image))))))))
(disable-theme theme))
(with-temp-file (concat (getenv "HOME") "/" "errors.el")
(insert (prin1-to-string
@@ -101,6 +119,7 @@ the theme came from."
(package-initialize)
(package-refresh-contents)
(package-install 'compat)
+(require 'compat)
(toggle-frame-maximized)
(fussy-generate-all-theme-images