diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-20 03:14:51 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-20 03:14:51 -0400 |
| commit | 350ccfa05732066baaa577bf05c98f2ac60dc2d3 (patch) | |
| tree | d04f618e403c10559df22c5805973d30a5164a8a /scripts/theme-studio/generate.py | |
| parent | 7e8f771408b7051066fb91fa9c68e80fa52405f7 (diff) | |
| download | dotemacs-350ccfa05732066baaa577bf05c98f2ac60dc2d3.tar.gz dotemacs-350ccfa05732066baaa577bf05c98f2ac60dc2d3.zip | |
feat(theme-studio): show face docstrings in element hovers
Each table row's category cell now shows the face's Emacs docstring on hover, on top of whatever the cell showed before. The package cell keeps the face name underneath. The syntax and UI cells had no prior tooltip, so they show just the docstring. The label-span hints are left alone.
I added face-docs-dump.el, which emits face-docs.json from a live Emacs: a face-name to first-doc-line map for the UI and package tables, and a category to doc map for the syntax table. The category to font-lock-face mapping is read from build-theme.el's own map, so it isn't copied a third time. generate.py inlines both maps. A pure composeHoverTitle helper composes the tooltip, covered by Node, Python, and a new browser gate.
Diffstat (limited to 'scripts/theme-studio/generate.py')
| -rw-r--r-- | scripts/theme-studio/generate.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/theme-studio/generate.py b/scripts/theme-studio/generate.py index 43ebf02c6..251c05036 100644 --- a/scripts/theme-studio/generate.py +++ b/scripts/theme-studio/generate.py @@ -58,6 +58,13 @@ PALETTE_ACTIONS_BODY=strip_exports(read_text('palette-actions.js')) # under the test harness while still shipping one self-contained HTML file. BROWSER_GATES_BODY=strip_exports(read_text('browser-gates.js')) COLOR_NAMES=read_json('color-names.json') +# Face docstrings (first line each), dumped from a live Emacs via +# face-docs-dump.el. Two maps: "faces" keyed by real face name (UI + package +# tables), "syntax" keyed by theme-studio category (the syntax table). Inlined so +# the element hovers can show each face's docstring on top of the existing title. +_face_docs=read_json('face-docs.json') +FACE_DOCS=_face_docs['faces'] +SYNTAX_DOCS=_face_docs['syntax'] ns={} src=read_text('samples.py') exec(src[:src.index('# THEME_STUDIO_DATA_END')], ns) @@ -273,6 +280,7 @@ def fill_data(s): .replace("PALETTE_ACTIONS_J",PALETTE_ACTIONS_BODY) .replace("BROWSER_GATES_J",BROWSER_GATES_BODY) .replace("COLOR_NAMES_J",json.dumps(COLOR_NAMES)) + .replace("FACE_DOCS_J",json.dumps(FACE_DOCS)).replace("SYNTAX_DOCS_J",json.dumps(SYNTAX_DOCS)) .replace("SAMPLES_J",json.dumps(SAMPLES)) .replace("PALETTE_J",json.dumps(PALETTE)).replace("CATS_J",json.dumps(CATS)) .replace("UIFACES_J",json.dumps(UI_FACES)).replace("UIMAP_J",json.dumps(UIMAP)).replace("APPS_J",json.dumps(APPS)) |
