diff options
author | colin <colin@cicadas.surf> | 2023-07-08 11:45:46 -0700 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2023-07-08 11:45:46 -0700 |
commit | 7f7df2c630a93f3ba210dc0e513186ad83bc184d (patch) | |
tree | b3ad1af92385ffc7449375c9141df4d067f37534 /fussy.el | |
parent | abc9190cdfc179c199cc8bc694cbd5add875ad77 (diff) |
Add: logging to fussy.el
Diffstat (limited to 'fussy.el')
-rw-r--r-- | fussy.el | 62 |
1 files changed, 46 insertions, 16 deletions
@@ -5,6 +5,17 @@ (require 'cl-lib) (require 'package) +(defun rel-to-home (file) + (concat (getenv "HOME") "/" file)) + +(defun fussy-log (string) + (let ((line + (concat string "\n")) + (logfile + (rel-to-home "fussy.el.log"))) + (write-region line nil logfile 'append))) + + (defvar +excluded-package-names+ '(tramp-theme color-theme airline-themes)) @@ -13,11 +24,15 @@ (string= suffix (cl-subseq str (- (length str) (length suffix)))))) - (defun fussy-is-theme-p (pkg-entry) +(fussy-log "one") + +(defun fussy-is-theme-p (pkg-entry) (let ((name (symbol-name (cl-first pkg-entry)))) - (and (or (fussy-string-ends-with name "-theme") - (fussy-string-ends-with name "-themes")) - (not (cl-member (cl-first pkg-entry) +excluded-package-names+))))) + (and (or (fussy-string-ends-with name "-theme") + (fussy-string-ends-with name "-themes")) + (not (cl-member (cl-first pkg-entry) +excluded-package-names+))))) + +(fussy-log "two") (defun fussy-themes-packages () "Setting FUSSY-THEME-PACKAGES-TO-LOAD at the command line will @@ -30,6 +45,8 @@ those." fussy-theme-packages-to-load (cl-remove-if-not 'fussy-is-theme-p package-archive-contents))) +(fussy-log "three") + (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 @@ -38,6 +55,8 @@ symbols, returning nil if not." (when (boundp 'fussy-excluded-themes) fussy-excluded-themes)) +(fussy-log "four") + (defun fussy-screenshot-svg (filename) "Save a screenshot of the current frame as an SVG image to a file called filename." @@ -47,15 +66,21 @@ called filename." (insert data)) (copy-file tmpfile filename t))) +(fussy-log "five" ) + (defun install-all-themes () + (fussy-log "installing all themes") (let ((failed-to-install nil)) - (cl-dolist (theme (fussy-themes-packages)) - (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)) + (cl-dolist (theme (fussy-themes-packages)) + (let ((package-name (if (symbolp theme) theme (cl-first theme)))) + (condition-case nil + (package-install package-name) + (error + (fussy-log (format "failed to install %s ... continuing" package-name)) + (push package-name failed-to-install))))) + failed-to-install)) +(fussy-log "six") (defun locate-theme-package (theme) "Given a symbol naming a theme, find the name of the package that @@ -75,20 +100,22 @@ the theme came from." "-")) "-"))) +(fussy-log "seven") + (defun fussy-generate-all-theme-images (&rest files) (let ((failed-to-load nil) (failed-to-generate-image nil) (failed-to-install (install-all-themes))) - (message "All themes have been loaded") + (fussy-log "Generating all theme images") (cl-dolist (theme (custom-available-themes)) (unless (member theme (fussy-themes-to-exclude-from-image-generation)) - (message (format "Generating for theme: %s" theme)) + (fussy-log (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!") + (fussy-log "... failed to load!") nil)) (dolist (file files) (let* ((theme-package @@ -117,7 +144,9 @@ the theme came from." (list :load-errors failed-to-load :generation-errors failed-to-generate-image :install-errors failed-to-install)))) - (message "FINISHED GENERATING THEME IMAGES"))) + (fussy-log "FINISHED GENERATING THEME IMAGES"))) + +(fussy-log "eight") (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) @@ -125,6 +154,8 @@ the theme came from." (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10")) + +(fussy-log "Starting ... ") (package-initialize) (package-refresh-contents) (package-install 'compat) @@ -133,8 +164,7 @@ the theme came from." (set-frame-height (frame-focus) 50) (set-frame-width (frame-focus) 100) -(defun rel-to-home (file) - (concat (getenv "HOME") "/" file)) + (fussy-generate-all-theme-images (rel-to-home "../fussy.lisp") |