diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-19 11:27:21 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-19 11:27:21 -0400 |
| commit | d6ee849f88f8fc3188f1bdd7f0198bffc010db49 (patch) | |
| tree | 8973e58eee563628bf1017312165c02ea5f9d09d /scripts/theme-studio | |
| parent | d32553aa1a8cd49a514a347558524c98eb566627 (diff) | |
| download | dotemacs-d6ee849f88f8fc3188f1bdd7f0198bffc010db49.tar.gz dotemacs-d6ee849f88f8fc3188f1bdd7f0198bffc010db49.zip | |
refactor(theme-studio): share the spec-from-entries loop in build-theme
The UI and package tier builders repeated the same "for each (face . obj) entry, build attrs, emit a non-empty spec" loop. Both now call one build-theme/--specs-from-entries helper; the package builder concatenates each app's specs in order. The syntax builder keeps its own form since it fans one category out to several font-lock faces. The 41 ERT tests stay green and the emitted themes are unchanged.
Diffstat (limited to 'scripts/theme-studio')
| -rw-r--r-- | scripts/theme-studio/build-theme.el | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/scripts/theme-studio/build-theme.el b/scripts/theme-studio/build-theme.el index e0a86f111..4432ef57c 100644 --- a/scripts/theme-studio/build-theme.el +++ b/scripts/theme-studio/build-theme.el @@ -198,28 +198,27 @@ Each category fans out to the font-lock faces in (push spec specs))))))) (nreverse specs))) -(defun build-theme/--ui-face-specs (ui) - "Build UI-tier face specs from the UI alist (face -> attribute alist)." +(defun build-theme/--specs-from-entries (entries) + "Build face specs from ENTRIES, an alist of (face . attribute-alist). +Empty-attr entries emit nothing (cleared faces drop out)." (let (specs) - (dolist (entry ui) - (let* ((face (car entry)) - (obj (cdr entry)) - (attrs (build-theme/--attrs obj))) - (when-let ((spec (build-theme/--face-spec face attrs))) - (push spec specs)))) + (dolist (entry entries) + (when-let ((spec (build-theme/--face-spec + (car entry) + (build-theme/--attrs (cdr entry))))) + (push spec specs))) (nreverse specs))) +(defun build-theme/--ui-face-specs (ui) + "Build UI-tier face specs from the UI alist (face -> attribute alist)." + (build-theme/--specs-from-entries ui)) + (defun build-theme/--package-face-specs (packages) "Build package-tier face specs from the PACKAGES alist (app -> face -> spec)." (let (specs) (dolist (app packages) - (dolist (entry (cdr app)) - (let* ((face (car entry)) - (obj (cdr entry)) - (attrs (build-theme/--attrs obj))) - (when-let ((spec (build-theme/--face-spec face attrs))) - (push spec specs))))) - (nreverse specs))) + (setq specs (nconc specs (build-theme/--specs-from-entries (cdr app))))) + specs)) (defun build-theme/--all-specs (data) "Build the full ordered face-spec list from parsed theme.json DATA." |
