From 33b1f209162f94a9200f8c00d131aae772eb02f2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 23 Nov 2026 15:14:44 -0300 Subject: help: a builtin's documentation is the `///` block right above its `pub const = struct`, read at compile time into one table, `registry.doc` (its summary, the first sentence, and all of it, a line a paragraph), and every reader takes the table (the user's words of 2026-11-23: "the builtins should have their documentation in code somewhere (you may use comptime to extract that) near their definitions"): the summary was found at run time, each word's by a scan of the embedded source for `\npub const = struct` (core/ninep/ctl.zig `summaryOf`), `stripCitations` cutting `(exec.c:892)` and the like out of it: both are deleted; THE CONVENTION is written at the top of core/builtins.zig (the `///` above a builtin is what a user reads in Help, `pardes help`, /commands, `pardes words` and the glossary; no file names, no "registration", no history; notes for the code's reader are `//` lines inside the struct) and the compiler holds what it can read of it: a builtin with no `///` block, a first sentence over `summary_max` (100 bytes) or a `///` naming a .zig file fails the build, naming the builtin (one pass over the source, `registry.docs`; a setting's documentation is its `Setting.doc`, held the same); 35 builtins' docs cut to it (a first sentence over 100 bytes split at a sentence, acme and source citations into `//` notes in the struct), and DumpDir's setting doc (core/config.zig) the same; /commands prints each word's summary whole (no clip: the bound holds it); the docs' JSON (core/builtins_json.zig) takes `doc` from the table and gains `text`, the whole documentation, beside it (an addon's word: its one `.doc` in both); docs/typ/builtins-tui.json regenerated (`zig build builtins-json -Dplatform=tui`; builtins-gui.json in the change that runs the window's gates); tests: builtins.zig "a builtin's documentation is the whole `///` block above it, a line a paragraph, its summary first", ctl.zig "every word's /commands description is its documentation's summary, a line" (replacing the source-scanning one); core-test 942/1108 (166 skipped; the base measures 941/1107 here, see the report), Debug, tui, load 2-7 Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/config.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/config.zig') diff --git a/core/config.zig b/core/config.zig index a2911dad..efde4626 100644 --- a/core/config.zig +++ b/core/config.zig @@ -799,7 +799,7 @@ pub const Settings = struct { .{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." }, .{ .word = "Pet", .action = .{ .choice = .pet }, .doc = "The window's companion in the workspace tag's blank space: off, cat or frog." }, .{ .word = "MessageLinger", .action = .message_linger, .doc = "How long, in milliseconds, a message stays after what dismisses it." }, - .{ .word = "DumpDir", .action = .dump_dir, .doc = "The directory of the state file Dump writes to and Recent is kept in, where a relative Restore name is looked for too; bare, the default." }, + .{ .word = "DumpDir", .action = .dump_dir, .doc = "The directory of the state file, where Dump writes and Recent is kept. A relative Restore name is looked for there too; bare, the default." }, .{ .word = "Theme", .action = .theme, .doc = "Switch to the named theme." }, .{ .word = "Shell", .action = .shell, .doc = "The shell new terminals run; bare, $SHELL if it is executable, else /bin/sh." }, .{ .word = "Font", .action = .font, .doc = "The body font, by name or path, and its size." }, -- cgit v1.3 From b1f5c788ddd14b832452c83524e2de527b0a0af0 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 23 Nov 2026 16:04:57 -0300 Subject: help: the settings' documentation read against what each takes (item 5's seventh group: core/config.zig `Settings.settings`, a setting's `.doc`, which the table reads and the compiler holds as a builtin's): the seventeen were already a user's sentences, each what the setting is and, in `Help `, what it takes (`Settings.takes`: `on, off`, `0-100 (a percentage)`, `1-16 (cells)` ...); three gain their example and the word that lists or steps them: Theme ("Switch to the theme named: `Theme atelier`. Themes lists them, NextColor steps through them."), Shell (`Shell /bin/zsh`), Font (`Font Mono:14`; Fonts lists them); DumpDir's was split in the table's change; docs/typ/builtins-tui.json regenerated Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/config.zig | 6 +++--- docs/typ/builtins-tui.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'core/config.zig') diff --git a/core/config.zig b/core/config.zig index efde4626..e9225c53 100644 --- a/core/config.zig +++ b/core/config.zig @@ -800,9 +800,9 @@ pub const Settings = struct { .{ .word = "Pet", .action = .{ .choice = .pet }, .doc = "The window's companion in the workspace tag's blank space: off, cat or frog." }, .{ .word = "MessageLinger", .action = .message_linger, .doc = "How long, in milliseconds, a message stays after what dismisses it." }, .{ .word = "DumpDir", .action = .dump_dir, .doc = "The directory of the state file, where Dump writes and Recent is kept. A relative Restore name is looked for there too; bare, the default." }, - .{ .word = "Theme", .action = .theme, .doc = "Switch to the named theme." }, - .{ .word = "Shell", .action = .shell, .doc = "The shell new terminals run; bare, $SHELL if it is executable, else /bin/sh." }, - .{ .word = "Font", .action = .font, .doc = "The body font, by name or path, and its size." }, + .{ .word = "Theme", .action = .theme, .doc = "Switch to the theme named: `Theme atelier`. Themes lists them, NextColor steps through them." }, + .{ .word = "Shell", .action = .shell, .doc = "The shell new terminals run: `Shell /bin/zsh`; bare, $SHELL if it is executable, else /bin/sh." }, + .{ .word = "Font", .action = .font, .doc = "The body font, by name or path, and its size after a colon: `Font Mono:14`. Fonts lists them." }, .{ .word = "TaglineSize", .action = .tagline_size, .doc = "Scale the tag font, a percentage." }, .{ .word = "WindowOpacity", .action = .window_opacity, .doc = "The window's opacity, a percentage." }, .{ .word = "CallstackDepth", .action = .callstack_depth, .doc = "Caller levels collected by Callstack, 1 through 64; default 8. Bare, it says the current limit." }, diff --git a/docs/typ/builtins-tui.json b/docs/typ/builtins-tui.json index e46d0e2f..8d4027e0 100644 --- a/docs/typ/builtins-tui.json +++ b/docs/typ/builtins-tui.json @@ -87,14 +87,14 @@ {"name": "Save", "leader": "SPC f s", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Write the pane's text to its file, or to the file its argument names.", "text": "Write the pane's text to its file, or to the file its argument names.\n`Save ` writes it there. Bare, a pane with no file of its own (a +New, a list, a terminal) asks for a path; a file at a revision is read-only, written only to a path. Over a file changed on disk since it was read, it warns once."}, {"name": "Search", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Search in a query pane under this pane, its line 1 the argument.", "text": "Search in a query pane under this pane, its line 1 the argument.\nLine 1's first word names what it searches: `/re` this pane's text, `Find`, `Grep`, `Recent`, `Panes`, `Symbols`, `All` (every open pane's text), `Refs`, `Def`, `Impl`, `Diagnostics`; a line with none of them is a `/`: `Search lay` is `/lay`. Bare, `/`, typed into. `SPC b b`, `SPC s s` and `SPC /` open it with Panes, Symbols and All."}, {"name": "SelectRefs", "leader": "SPC l h", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Select every reference to the symbol under the cursor.", "text": "Select every reference to the symbol under the cursor."}, - {"name": "Shell", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "The shell new terminals run; bare, $SHELL if it is executable, else /bin/sh.", "text": "The shell new terminals run; bare, $SHELL if it is executable, else /bin/sh."}, + {"name": "Shell", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "The shell new terminals run: `Shell /bin/zsh`; bare, $SHELL if it is executable, else /bin/sh.", "text": "The shell new terminals run: `Shell /bin/zsh`; bare, $SHELL if it is executable, else /bin/sh."}, {"name": "Subtypes", "leader": "SPC l T", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the subtypes of the type under the cursor in a +Search; a single one is a jump.", "text": "List the subtypes of the type under the cursor in a +Search; a single one is a jump."}, {"name": "Supertypes", "leader": "SPC l t", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the supertypes of the type under the cursor in a +Search; a single one is a jump.", "text": "List the supertypes of the type under the cursor in a +Search; a single one is a jump."}, {"name": "Symbols", "leader": "SPC l s", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List this file's symbols in a +Search.", "text": "List this file's symbols in a +Search."}, {"name": "Syntax", "leader": "SPC t h", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Turn this text's syntax colours off in this view, or on again.", "text": "Turn this text's syntax colours off in this view, or on again."}, {"name": "Tab", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "A tab's width in cells, 1 through 16, in every pane; bare, it says the width.", "text": "A tab's width in cells, 1 through 16, in every pane; bare, it says the width."}, {"name": "Term", "leader": "SPC n t", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Open a terminal below this pane, in its directory, raw: its keys the shell's at once.", "text": "Open a terminal below this pane, in its directory, raw: its keys the shell's at once.\n`Term fish` runs that shell instead of the Shell setting's, as a terminal's own tag word `Term+fish` says; a shell that is not there is said. A directory that is not there makes no terminal."}, - {"name": "Theme", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Switch to the named theme.", "text": "Switch to the named theme."}, + {"name": "Theme", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Switch to the theme named: `Theme atelier`.", "text": "Switch to the theme named: `Theme atelier`. Themes lists them, NextColor steps through them."}, {"name": "ThemeFile", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Load a theme from a file.", "text": "Load a theme from a file."}, {"name": "Themes", "leader": "SPC t t", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "List the themes in a pane, each a word to click.", "text": "List the themes in a pane, each a word to click."}, {"name": "Togglettymode", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Switch this terminal between raw mode, its keys the program's, and normal mode.", "text": "Switch this terminal between raw mode, its keys the program's, and normal mode."}, -- cgit v1.3