Planet Scheme

Thursday, December 3, 2026

jointhefreeworld

Sift: the Lisp formatter I kept trying to write (+lint +LSP)

sift is one Guile program: a formatter, a linter and a language server for Scheme, Racket, Emacs Lisp and Common Lisp. It has 95 rules, formatting is idempotent, and it runs in your editor, your terminal, CI, a container and a browser tab.

I’ve been writing Lisp for a few years, and for most of that time my tooling was a pile of workarounds. Two editors disagreed about indentation. CI formatted the code one way and my editor another. A compiler warning was prose: no stable code, no severity, no JSON, no way to suppress it next to the line that caused it, no fix. A repository with Scheme, Emacs Lisp and Common Lisp needed three tools, three configs and three CI steps. sift is the first thing I’ve built that reads the file instead of guessing at it.

This is the program I’ve been trying to write for years. I finally got it.

Find sift at https://github.com/jjba23/sift, and try it in your browser at https://jointhefreeworld.org/sift/.

sift lint, fix and format in a terminal, then the same file in Emacs
sift lint, sift fix --write, the formatter's diff, and the same file in Emacs with Flymake, Eglot and formatting. Recorded from a checkout.


The problem  #

Lisp is a tree of nested lists. The language knows it; most of the tooling around it pretends otherwise, sometimes with regex.

Go has gofmt and Rust has rustfmt: one program, the same answer on every machine. In the Lisp world the answer is usually “my editor does it”, “the compiler warns about it”, “we have a fmt task somewhere”, or “run guix style on the package file”. Those are local opinions, some with a batch mode.

That was my situation. My projects are Guix and Guile, Emacs Lisp and a little Common Lisp; Racket is the fourth dialect sift grew into. Formatting was a maak fmt task running guix style on every .scm file and Emacs’s indent-region on every .el file. Linting was checkdoc, the byte-compiler, guild compile -W3, guix lint, stylelint, and a hand-written checker that read every .el form to prove the config still loaded. Each tool was good at its slice. None of them was the thing I wanted, and they disagreed at the boundaries.

The failed attempts  #

I didn’t design sift in one go. I kept solving the problem with the tools I had, and each attempt taught me one piece.

The keyboard macro  #

Tabs to spaces, trailing whitespace gone, indent-region, save, stare at the diff. Then a sed script. It felt like magic for about a day, until I hit a form whose indentation depended on what the form meant. The mechanical part is easy. The structural part is the whole problem.

Emacs in batch  #

The obvious next step was Emacs’s own indentation engine over the whole tree. I had a file called batch-indent.el:

( defun  indent-file ( &optional save)
   "Format the whole buffer."
  (indent-region (point-min) (point-max) nil)
  (untabify (point-min) (point-max))
  (delete-trailing-whitespace)
  ( when save
    (save-buffer)))
copy

Lisp indentation is structural, and the modes encode decades of convention, so for a while this felt like a formatter. But the answer depends on scheme-mode, Geiser, the project’s indent-rules and the Emacs version, so two machines could format the same file two ways and both were right according to their setup. It only indents, so it doesn’t own the printer, isn’t a fixed point, and has no lint, no exit status and no report.

guix style  #

Next I tried the canonical tool where one existed. guix style knows how a package definition should look, and it has taste. It also formats package definitions, not Scheme: not my modules, not my SXML, not my general procedures or comments. It reflows, so every new idea about line breaks turns every file into a diff. And the .el files still went to Emacs, which left the repo with two formatters and a boundary where they disagreed. I kept the ambition, and the suspicion that reflowing was the enemy.

The compiler  #

Then I tried to stop writing a linter and use the ones the language already had: checkdoc and the byte-compiler for Emacs Lisp, guild compile -W3 for Scheme, guix lint in Guix buffers, plus a small checker that read every .el form and compared the module list in init.el with the files on disk:

( while ( progn (forward-comment (point-max)) (not (eobp)))
  (read (current-buffer)))
copy

This taught me the most important lesson of the bunch: the language’s own reader and compiler know more than any regex. A file that doesn’t read is a finding. A docstring that doesn’t name its arguments is a convention the byte-compiler cares about. lexical-binding isn’t taste; it’s a header the file needs.

But read throws away the evidence. It discards comments, keeps no positions, and can’t represent a block comment, a datum comment or a reader prefix as a node.

The pretty-printer  #

Once the tree worked, I thought the next step was a pretty-printer that decided line breaks from structure, the way Prettier does. The output was beautiful. Then I ran it on a 300-line file and the diff touched every line. git blame stopped working, and every future change would be buried under the formatter’s opinions. I reverted the file and never wrote that pretty-printer again. That’s where the no-reflow rule comes from.

read plus a scanner  #

Before I wrote the reader, I tried to build the linter on Guile’s read plus a line scanner: read gave me forms, the scanner gave me lines, and a table mapped one to the other. Comments fell through the table. A comment inside a form, a #; datum comment, a string with a semicolon in it: the two representations disagreed and I couldn’t tell which one was right. I gave up and wrote the reader. One representation has to win, and it has to carry positions.

The pre-commit hook  #

I wired guix style and emacs --batch into a pre-commit hook. It was fast and useful, and it caught tabs and trailing whitespace before they landed, but it only caught what those tools caught, it couldn’t fix anything, and every repository had its own copy. The pipeline shape was right. The tool behind it was missing.

One tool per dialect  #

The obvious next move was one tool per dialect: Racket’s formatter for Racket, guix style for Scheme, Emacs for Elisp, something else for Common Lisp. It worked, in the sense that each dialect got a tool. It gave me four tools, four configs, four CI steps and four styles that disagreed at the boundaries.

What it is  #

One executable  #

sift format [OPTIONS] [FILE...]      #  print the formatted file
sift lint [OPTIONS] [FILE...]        #  report findings
sift check [OPTIONS] [FILE...]       #  print the patch, exit 1 if any
sift fix [OPTIONS] [FILE...]         #  lint --fix
sift ci [OPTIONS] [FILE-OR-DIR...]   #  format check + lint, never writes
sift lsp                             #  a language server on stdin/stdout
sift doctor                          #  what ran, what it read, what it decided
sift list-checkers [--dialect D]     #  the catalogue as a table
sift explain RULE                    #  one rule's reasoning
sift config show|explain|trust ...   #  the settings, and which layer won
sift install-hooks [--force]         #  a pre-commit hook that runs `ci'
copy

Status 0 is clean, 1 is findings, 2 is a usage error or a file that can’t be read.

The dialect is explicit ( --dialect), then the extension, then the shebang, then a marker in the first 200 lines: #lang is Racket, defpackage is Common Lisp, define-module is Scheme, lexical-binding is Emacs Lisp. If none answers, it says so. It never guesses.

$ cat square.scm
(define (square x)
(* x x))

$ sift check square.scm
--- square.scm
+++ square.scm
@@ -1,2 +1,2 @@
 (define (square x)
 -(* x x))
+  (* x x))
$ echo $ ?
1
copy

check prints the patch and exits 1. It never modifies your files. sift format --write square.scm makes the change, and the next sift check exits 0.

When the environment and the tool disagree, ask the tool:

$ sift doctor
sift 1.41.2
  guile       3.0.11
  library     /home/joe/Hacking/sift/src
  rules       95
  dialects    scheme, racket, elisp, cl

Compilers
  scheme available
  elisp available
  cl not found

Configuration
  project  /home/joe/project/sift.yaml

Settings that are not the default
  brackets: square    #  /home/joe/project/sift.yaml
  severity: warning    #  /home/joe/project/sift.yaml
copy

The formatter  #

Every node carries its source location. Comments, blank lines, datum comments and reader prefixes are nodes, not trivia. A file with one broken form still gets a tree, because a linter that says nothing about a file it couldn’t parse fails exactly when it’s needed.

The reader knows each dialect’s read syntax rather than a compromise: #\a is a character in Scheme, Racket and Common Lisp and ?a in Emacs Lisp; #:key is an uninterned symbol and :key a keyword; #| ... |# nests; #; comments out the next datum; #lang opens a Racket module; a square bracket is a vector in Emacs Lisp and a clause delimiter in Scheme. sift doesn’t average the two.

The formatter does six things: normalise line endings, normalise spacing, place closing delimiters, compute indentation, optionally align inline comments, and preserve blank lines up to the style’s limits. Everything else comes out as written, including line breaks, strings, escapes and comments. Run it twice and you get the same bytes; the suite formats every fixture and then formats the result to check.

Indentation is three rules. A form whose first element is a symbol is looked up in the dialect’s table; a data list or vector aligns under its first element; anything else lines its arguments up under the first argument. That’s the whole algorithm. The tables exist for the forms where structure alone isn’t enough.

Two styles. community keeps closing delimiters trailing, dangling puts each on its own line. Scheme writes cond clauses with square brackets, as Guile and Guix do, and --brackets=parens or --brackets=preserve changes that; Emacs Lisp and Common Lisp keep what they were given. The clause-brackets rule ( SIFT036) reports a file that hasn’t been formatted yet, and its fix swaps the two characters.

It refuses to reflow a long line (the line-length rule warns instead), invent a missing parenthesis, rewrite an expression, or format inside a #; datum comment, a #. form or a #<...> object. sift fix doesn’t reformat, because a fix that moved whitespace would touch every line of the patch it was meant to make readable.

The linter  #

A rule is a record: name, code, description, dialects, default severity, procedure and example. The driver reads the file once, runs the rules the dialect applies to, folds in what the reader reported, honours suppression comments, and sorts the findings by file, line, column and rule. There are 95 rules, each with a stable code ( SIFT001 through SIFT095), assigned by hand and never reused. sift explain RULE reads the reasoning out of the program, and doc/rules.org is generated from the records.

The catalogue, condensed:

Where What it checks
all four whitespace, line length, delimiters, empty bodies, progn, blank lines, comment levels, single-letter names, the if / when / unless family, keyword arguments, complexity
Scheme and Racket internal defines, letrec, quasiquote, clause brackets, docstrings, eta and beta reduction, let simplification
Emacs Lisp docstrings, lexical-binding, interactive, provide, declare, require-cl, save-excursion-set-buffer
Common Lisp package prefixes, double colons, dangling parentheses, LOOP style, identity, ecase-otherwise, mixed-lambda-list
Guix gexps, #$output, with-imported-modules, phase names, sha256, package synopses, inputs
SXML attribute lists, children, empty elements

sift explain if-without-else prints that record: the code, the name, the description, the dialects, the severity, a failing example and the expected fix. A diagnostic and a documentation page are the same data, which is the part I like most.

A rule may carry a fix, which is one range. sift lint --fix applies fixes from the highest offset down, then lints once to show what’s left; there’s no loop. If a fix introduced a parse error the file didn’t have, every fix of that run is discarded and the original findings are reported. A file the reader couldn’t finish is refused, because a fix around a missing parenthesis would be a guess. --force is for a caller who knows better.

Some rules have no fix on purpose. unmatched-parens won’t guess where a ) belongs. wrap-in-let won’t invent a binding name. The naming rules won’t rename anything. blank-line-in-body won’t delete a line. Deciding how to split or name code is your work.

Suppression is a comment, not a config list:

 ;;  sift:disable-next-line keyword-arguments
(make-window a b c d e f g)

 ;;  sift:disable wrap-in-let
( define ( f x)
  ...)
 ;;  sift:enable wrap-in-let
copy

disable-next-line covers the next line, disable covers to the end of the top-level form, and enable ends it. An exception list in a config file is a list no review reaches. This one is in the diff.

Fixing isn’t filtered by severity. severity: warning says what fails a build, not what’s worth repairing on request.

Configuration  #

format prints, --write writes, check answers with a patch and a status, lint reports, lint --fix fixes, and ci asks both questions without touching the tree. A job that edits the tree it’s judging is a job whose verdict means nothing.

The same findings come out as the compile-style line file:line:column: severity: [rule] sentence, JSON, SARIF, GitHub annotations, or null. --watch re-runs when a file the run read changes. SIFT_JOBS is the only setting that controls parallelism.

Settings are sift.yaml, or a sift.scm the project has trusted. They’re layered: defaults, system, user, project, command line. Discovery stops at the repository root. YAML is data and can’t execute anything; Scheme is code and must be trusted explicitly, with --config, SIFT_TRUST_CONFIG=1 or sift config trust sift.scm. An unknown key is refused with a position, and sift config show --verbose names the layer that won.

line-length: 90
brackets: square
severity: warning
checkers: [trailing-whitespace, docstring-missing]
stdlib: true
copy

The formatter has few knobs on purpose: a formatter with a hundred options has no opinion. The tuning lives in the linter, where you choose which of the 95 rules run, what their thresholds are, and which severity fails a build. The language server reads the same files, so sift.yaml is the single place where editor behaviour is written down: inlay hints, hover, completion, stdlib, downloads, compiler diagnostics, import organization.

The language server  #

sift lsp speaks LSP over standard input and output, so the editor and the pipeline get the same findings, fixes and formatting.

It answers diagnostics, quickfixes, fix-all, the extract and inline refactors, import organization, formatting, hover, definition, references, highlights, symbols, completion, inlay hints, rename and signature help; a file rename keeps a Scheme module or an Emacs Lisp provide in step.

It refuses the type hierarchies, semantic tokens, code lenses, folding, range formatting, format-on-type, pull diagnostics and workspace folder changes. sift models no types, expands no macro, and has no opinion about what to fold. “Method not found” is more useful than a plausible lie.

The project is read in a thread from initialize on. Two thousand files arrive in batches of sixty-four, so the first answer comes after the first batch and each later batch replaces the snapshot whole. A jump has 100 ms, a reference search 200 ms, and sift/indexStatus says how far the reading has got.

The standard library is indexed from source: Guile’s modules, Emacs’s load-path and package trees, ASDF and SBCL sources, Racket’s collects and pkgs, and what each implementation says about itself. car is compiled into libguile and no file says where, so the implementation is asked once to write down every name it documents, as source. A jump to car lands in code that reads like the file it’s in. Writing that felt a little illegal, and it’s the LSP work I’m proudest of.

The server can ask the dialect’s compiler for a second opinion on open or save: guild, emacs, sbcl, whichever is installed. A missing compiler is simply not asked, and compiler-diagnostics: false turns it off.

The editing loop  #

My Emacs configuration ( heks-emacs) puts a Geiser REPL in the middle of Scheme development. C-c g r starts or switches to the project’s REPL: a guix repl in a package buffer, a plain guile one elsewhere, one per project. C-c g e evaluates the definition at point, C-c g b loads the file, C-c g k interrupts, C-c g d opens the debugger.

sift runs in the same buffer, at the same time, without asking the REPL for anything. sift-flymake runs sift lint --stdin --format=json on the buffer’s own text, saved or not, and turns findings into Flymake diagnostics with the rule’s code and name. The drift backend marks the lines sift format would rewrite. C-c g H explains the rule at point, C-c g a applies its fix, C-c g A applies every fix, C-c g f formats. Nothing is written; every step is one undo away.

The REPL and the linter answer different questions. The REPL knows what the program does when it runs: the loaded state, the values, the stack, the debugger. sift knows what the file says and what a pipeline will say about it, which is how it can tell you that a cond clause after else can never run, that an import is unused, or that a line isn’t formatted the way sift ci will require. A REPL can’t tell you your file is unformatted, and a formatter can’t tell you what an expression returned. So sift is asked first, because it needs nothing but itself; guild compile and guix lint are the second opinion on save; Geiser is the third, for what only a running image knows.

The loop I do a hundred times a day: start the REPL, write a one-armed if, watch SIFT012 appear on a dirty buffer, read the rule, apply the fix, evaluate the definition, format, reload. No save and no build in the middle.

Editors, CI and the browser  #

The clients are thin wrappers over the program:

Editor What to use
Emacs emacs/sift.el: Flymake and Eglot
Neovim editors/vim/neovim.lua: a vim.lsp.start setup
Vim editors/vim/: :SiftLint, :SiftFormat, :SiftFix, :SiftExplain
VS Code editors/vscode/: no build step, no dependencies
Helix format on save through sift format --stdin
the browser web/: sift compiled to WebAssembly

In a pipeline, one command asks both questions:

sift ci src/ tests/
copy

It exits 1 if either check finds something, 2 if a file can’t be read or parsed, and it never writes. There’s a reusable GitHub workflow:

name: sift
on: [push, pull_request]
jobs:
  sift:
    uses: jjba23/sift/.github/workflows/sift.yml@v1.41.2
copy

It annotates the diff and uploads SARIF to code scanning, so an unfixed finding becomes an alert instead of a line in a log. There’s also a composite action, a pre-commit hook, a pre-commit declaration, a dprint process plugin, and a Docker image.

The browser build sounds like a stunt and isn’t. web/ is formatting and linting compiled to WebAssembly with Guile Hoot, with an editor page around it. The same reader, formatter and 95 rules are in the tab; the two rules that need a project report nothing, and no input leaves the tab. The whole contract is one procedure of one string to one string:

(web-request  "{\"op\":\"lint\",\"source\":\"(if a b)\"}")
 ;;  => "{\"ok\":true,\"result\":{\"warnings\":[…],\"counts\":{…}}}"
copy

The module is 3.4 MB. A screenful formats in 17 ms and lints in 56 ms; 1.2 kB is 52 ms and 145 ms; 6 kB is 780 ms and 1.2 s. The first two rows never reach the 300 ms debounce. The number isn’t the interesting part. The source of truth stayed put: the tab runs the same modules bin/sift runs, four Guile libraries have stand-ins in web/compat, SRFI-13 is thirteen procedures with a test that compares the browser’s answers to Guile’s byte for byte, and eight tests hold the dependency one way.

The page is live at https://jointhefreeworld.org/sift/: an editor with the dialect, style and severity as controls, findings linked to the source, an outline, completion, inlay hints and a rules browser.

The sift editor in a browser tab
The browser build at jointhefreeworld.org/sift. The same reader, formatter and rules, compiled with Guile Hoot.

What a run costs  #

On my machine:

lint the tree (28 files, 14896 lines)       337ms, 160.7 MiB allocated
check the tree (28 files): format           253ms,  59.0 MiB allocated
lint (lsp.scm, every checker)               171ms,  19.2 MiB allocated
read the tree (28 files)                    143ms,  44.7 MiB allocated

Both numbers matter: a pass that conses per node makes every other pass slower, and the allocation count shows it even when the clock looks good. Three questions dominated the cost of a lint, each originally answered by walking something a second time: whether a node is code or data, what a form is called, and where the lines begin. Computing each once took a lint of the repository from twenty-five seconds to under one, and the allocation from a gigabyte and a half to a hundred and forty megabytes.

The suite I ran while writing this: 119 suites, 1160 tests, 2624 assertions, about a minute. The reader is tested dialect by dialect, the formatter on a golden corpus plus an idempotence pass, each rule with a passing case, a failing case and a re-lint after its fix, the CLI as a subprocess, the language server over the wire. The project formats itself, so maak self-check is a real gate.

The style  #

The style is the common practice of the four communities, written down in doc/style.org: Riastradh, Google’s Common Lisp guide, the Emacs Lisp manual’s docstring tips, R7RS, and the conventions of Guile and Guix.

The short version: two columns for every body; arguments align under the first; one blank line between top-level forms, never inserted where there was none; closing delimiters trail unless a project says dangling; square brackets for Scheme clauses as a setting, not a law; keywords line up; your macros get your indent rules, because no formatter knows what your macro means; no reflowing, since a line break records where you judged the form to end; a reader prefix glues to its datum; a comment stays on its line.

sift declines some Riastradh rules: a 72 or 80 column limit (the default is 96, or 80 for Emacs Lisp), pages and form feeds (they rewrite every line number below the break), 21-line top-level forms, and with- versus call-with- prefixes, which needs to know whether an argument is called.

What it won’t do is the other half of the style. It doesn’t rename, reorder or inline a procedure on its own, and it doesn’t introduce a delimiter. It never guesses a dialect. A fix it can’t verify is discarded, not applied with a warning. Lint reports, fix is opt-in, and CI never writes. Suppression belongs next to the code, and codes never move, because a code is what an editor and a bug report quote. Few knobs: a formatter with a hundred options has no opinion. Refuse what you can’t answer. The browser is a compile of the same modules and the editors are thin wrappers, so there’s no second implementation. MIT, because a formatter in other people’s pipelines can’t carry a licensing question.

It doesn’t expand macros, type-check or know your conventions. It reports and you decide. Where it can be wrong, the rule says so: wrap-in-let is a suggestion, keyword-arguments counts, thresholds are settings. The LSP has two limits: references are matched by name within one dialect, and the project is read in the background, so a jump answers from what’s been read. Range formatting, format-on-type, fold ranges, macro-introduced names, pull diagnostics and a --since REV mode are in scope and not built yet.

Compared to the neighbours  #

Clojure is the one Lisp community that has this. cljfmt formats and clj-kondo lints, both good, and both Clojure-only. Outside it, Scheme has scheme-mode, guild compile -W3 and guix style, and none of them is a general formatter, a project linter or an LSP. Emacs Lisp has checkdoc and the byte-compiler, but a compiler warning is prose: no stable code, JSON, SARIF, CLI or fix. Common Lisp has SLIME and SLY, which are an environment, not a program a pipeline runs. Racket has its own tools, and a repo with Scheme and Elisp still needs the others.

The canonical formatters are the other reference point. rustfmt and gofmt are one language, one style and no linting; their authority comes from being canonical, while sift has to write the style down. clang-format makes configuration its product, which is the opposite bet. Prettier is the closest in philosophy, but it reflows and doesn’t preserve every comment and blank line.

The neighbours do three things I want to steal: a checkable macro configuration from clj-kondo, answers from real analysis from SLIME and SLY, and the authority of a canonical tool from rustfmt and gofmt.

Inside Guix and Guile the gap is habits: assoc-ref %outputs, a #$output that makes a file, a use-modules inside a gexp that with-imported-modules doesn’t mark, an unquoted phase name, a sha256 that isn’t (base32 "..."), a synopsis that opens with an article, inputs written as a labelled alist. Those are rules with codes and fixes now.

Under the hood  #

src/sift/ is one module per job:

records.scm       locations, findings, rule records, codes, AST nodes
reader.scm        the permissive, location-preserving reader
format.scm        the pipeline, indentation tables, renderer
checkers/         one module per family of rules
lint.scm          run, suppress, filter, sort, fix, re-lint
render.scm        human, JSON, GitHub, null, SARIF
config.scm        discovery, merging, provenance, trust
lsp.scm           diagnostics, actions, formatting, hover, navigation
cli.scm           args-fold, dispatch, exit codes

records is the vocabulary; reader and format use it; the checkers use records and check/base; lint assembles them; render prints; lsp speaks the protocol; cli wires it up. Nothing in format or a checker knows about ports or exit codes.

The implementation is Guile 3.0 and the standard library. No C dependency, no build step. The launcher is a small POSIX shell script that finds its own symlink chain, puts src/ on the load path and hands the arguments to (sift cli).

Install with guix install sift from the guix-jointhefreeworld channel, nix run from the Nix flake, Homebrew from the tap, a container image, or a checkout and ./bin/sift version. The Emacs package is one file with no dependencies beyond Emacs 28.1.

Come help  #

The list of Lisp dialects that deserve a better reader is long.

  • A bug report. Give the input, the output you expected, and sift version with the first section of sift doctor. A file sift refuses to parse is a bug even when the file is broken; the message must say where.
  • A rule. One record and one test file. The catalogue, docs and editor integrations follow.
  • A dialect detail. An escape, a comment in an odd place, a body that indents by something other than two.
  • An editor integration. Neovim, Vim and VS Code each have a directory and a test; a fourth editor is one directory more.
  • A sentence in the docs. A sentence that causes hesitation is a defect.

To start: read doc/style.org, run maak test, add the rule or fix with its test under tests/checkers/, then run maak self-check, maak check and maak fixture-check. Send a pull request, or a patch with git format-patch and git send-email.

The AI policy is short: agents may explore, plan, branch, run the build and tests, commit, push, open and merge pull requests, and cut releases. A human is the author of record and must be able to explain and debug every line. TDD is required, and the tool and what it did are disclosed. A rule written with an agent is as welcome as one without; the review concerns the code.

What’s next  #

  • Range formatting and format-on-type. The formatter indents from column zero, so a fragment lands at the margin. The hard part is an origin column that still produces, for the range it touched, the bytes a whole-buffer run would.
  • A --since REV mode. Lint the lines a diff touched, not the whole tree, so a large codebase can adopt a linter without a mass reformat.
  • Resolution across files. Follow define-module, #:use-module, defpackage and provide far enough that a reference is a binding, not a name. Then a project-wide rename is correct in every file.
  • A declared-macro table. A project declares what its macros bind, so references and rename can see the names a macro introduces.
  • The style as a specification. The rules and the corpus are already there; the next step is a document a second implementation can be checked against.
  • A fifth dialect. Racket was the fourth and cost a table, a dozen rules re-argued and a corpus of its own. Each one after that is more evidence that the reader, formatter and rule records are the general part.

None of this is a promise with a date. If one of them sounds like your afternoon, open an issue and I’ll help you land it.

Closing  #

The failed attempts taught me that a Lisp file is a tree, that a community can agree on a style and a program can enforce it, and that the language’s own reader and compiler know more than any regex. The detours taught me the rest: never reflow, let one representation win, put the conventions in a program, ship one executable.

What none of them had was the premise: read the file as a datum with positions and print it back. Once that was true, formatting became a fixed point, a fix became a range, a finding became data, and the editor and the pipeline got the same answer. The seeds weren’t wasted either. They were the reader, the style and the rules, waiting for the thing that would hold them together. The name is the bet: a source file mixes the program with the layout; sift separates them, checks the program, and puts the layout back.

If you have a Lisp dialect that deserves a better reader, a rule your project keeps repeating in review, or an editor that should have the server, come and plant one.

Thursday, December 3, 2026

Monday, November 30, 2026

Scheme Requests for Implementation

SRFI 282: Additional R7RS (Type) Predicates

SRFI 282 is now in final status.

Types and entities deserve predicates so that their user can meaningfully understand what they are dealing with, and usefully dispatch on them in their code. However, some R7RS “types” have no respective predicates. This SRFI defines them.

by Artyom Bologov at Monday, November 30, 2026

Saturday, November 28, 2026

crumbles.blog

Note about my fediverse account

Update, 29 November: The suspension has now been reversed and I received an apology from the mastodon.social moderation team. They acknowledged having made a mistake, and say there is a discussion internally on how to prevent the mistake recurring.


My fediverse account, @dpk@swhack.com, has been suspended on the largest Mastodon instance, mastodon.social, for unclear reasons since roughly Tuesday 24 November.

This apparently means that if you have your account on mastodon.social and I was following you, I can no longer see your posts, but if you were following me, you may still be following me but I doubt you will see any of my posts there.

At the beginning of September I moved from chaos.social to my own Mastodon instance, meaning I should be able to see moderation reports made against my own account. I did not receive any report about my account before the suspension was made, and I only noticed because posts from people I also follow via Bridgy on Bluesky only showed up on the Bluesky side and not in my own fediverse timeline.

Attempts to reach the moderation team of mastodon.social have thus far not yielded a reply. I’m going to continue to follow this up and hopefully get it resolved soon.

Saturday, November 28, 2026

Friday, November 27, 2026

Joe Marshall

Updates to named-let

Updating named-let: ignored bindings, multi-form inits, and more

named-let is a small Common Lisp library of Scheme-inspired binding macros: named-let, named-lambda, letrec, letrec*, flambda, and a Lisp-1 style define. It also provides an extended let that you can shadow-import in place of the standard one. This post describes a round of changes to the library: a new way to ignore bindings, clarified handling of multi-form bindings, a bug fix, and improvements to documentation and tests.

Ignored bindings with _

Sometimes you want to bind something only for its side effect. In standard Common Lisp you must invent a variable and declare it ignored:

(let ((a 22)
      (dummy1 (format t "foo"))
      (b (sqrt 2))
      (dummy2 (format t "bar")))
  (declare (ignore dummy1 dummy2))
  body)

Now the extended let does this for you. Any binding of the symbol _ is replaced by a fresh uninterned symbol (a gensym), and a single ignore declaration for all such symbols is added at the start of the body:

(let ((a 22)
      (_ (format t "foo"))
      (b (sqrt 2))
      (_ (format t "bar")))
  body)

;; expands to

(let ((a 22)
      (#:ignore-1 (format t "foo"))
      (b (sqrt 2))
      (#:ignore-2 (format t "bar")))
  (declare (ignore #:ignore-1 #:ignore-2))
  body)

A few details worth knowing:

  • The init forms are still evaluated, and in order, so _ is useful for side effects.
  • You can have any number of _ bindings; each gets its own gensym, so there is no “variable occurs more than once” error.
  • The bare forms _ and (_) are accepted and bind to nil.
  • _ is matched by name, not by identity, so it works no matter which package your code is read in.
  • A declare at the start of your own body coexists with the generated one.
  • Because the generated declaration is placed first, the ignored variable can never be referenced from the body; _ is not a variable you can read.

The same convention applies to a named let, because its bindings become the parameters of a named-lambda, and to named-lambda parameters themselves:

(funcall (named-lambda second-arg (_ x _) x) 1 3 2)
;; => 3

(funcall (named-lambda f (a &optional (_ 9)) (+ a 3)) 1)
;; => 4

Multiple forms in a binding

A binding in the extended let may contain more than one init form. The forms are wrapped in a progn and the last value is bound:

(let ((a (format t "binding a") (+ 2 (sqrt x))))
  (+ a b))

;; expands to

(let ((a (progn (format t "binding a") (+ 2 (sqrt x)))))
  (+ a b))

The library already handled this, so no code change was needed, but it is now pinned down with a test and documented. As in standard Lisp, a bare variable y or a one-element binding (z) is bound to nil, and all bindings are made in parallel: init forms do not see the new variables.

How the expansion works

The extended let looks at its first argument. If it is a list (or nil), it is an ordinary binding list; the macro walks the bindings, replaces each _ with a gensym while collecting the gensyms, and emits the underlying let with the bindings, an optional (declare (ignore ...)), and the body. If the first argument is a symbol, it is the name of a named let and the expansion is a funcall of a named-lambda.

As before, the macros are SERIES-aware. Expansions refer to let and funcall in the SERIES package when it is loaded and the symbol is fbound there, and to COMMON-LISP otherwise. That is why an expansion you inspect in an image with SERIES loaded will begin with series::let. Expansion templates use qualified symbols so they resolve to COMMON-LISP symbols regardless of any shadowing in the consumer's package.

A bug fix in named-lambda

Writing more tests for _ turned up two bugs in named-lambda, which also supports _ parameters:

  1. The binding that extracts an optional docstring had a misplaced parenthesis, which made the let* binding spec malformed and caused a compile error in the macro definition.
  2. It recognised _ by comparing with eq against the symbol named-let::_. A _ read in any other package is a different symbol and so was not recognised, leading to a “variable _ occurs more than once in the lambda list” error. It now compares symbol names, exactly as let does.

Docstrings and comments

Every macro in the library now has a docstring. named-lambda and named-let were missing them, and letrec* had copied letrec's text; it now says its bindings are initialised sequentially so later ones can use earlier ones. I also added short comments in the places where the code is not self-explanatory: the gensym-and-declare logic in let, the difference between letrec (simultaneous assignment) and letrec* (sequential assignment), and the _ handling in named-lambda.

Tests

The FiveAM suite grew from 24 to 44 checks. The new tests cover:

  • _ in let: evaluation order of the init forms, the shape of the expansion (distinct uninterned symbols and a single declare), bare _ and (_), all-_ binding lists, and a user declare alongside the generated one.
  • Multi-form bindings, both the expansion and the resulting value and side effects.
  • Parallel binding semantics and a let with only a declare in its body.
  • named-lambda with repeated _ parameters, _ with a default in &optional, and a docstring.

Run them with (asdf:test-system "named-let-test"). One practical note when writing your own: do not use names locked by the implementation (such as loop or count) as the name of a named let.

Documentation

The README was rewritten with a summary table and examples for every macro, including the previously undocumented flambda. Along the way I corrected a few inaccuracies: the clone URL, and the claim that define defines local functions (it is a top-level form that stores the function in the symbol's value cell and defines a macro that funcalls it).

There is also a short section on choosing a name for a named let. When the name just means “go around again”, a short one such as next or l reads well:

(named-let next ((i 0) (acc '()))
  (if (= i 5)
      (nreverse acc)
      (next (1+ i) (cons (* i i) acc))))
;; => (0 1 4 9 16)

You cannot call it loop: COMMON-LISP already binds that symbol as a macro, and implementations such as SBCL lock the package. The same is true of other standard names like count.

Getting it

The code is on GitHub at jrm-code-project/named-let. Clone it into your Quicklisp local-projects directory and load it with (ql:quickload "named-let").

by Joe Marshall at Friday, November 27, 2026

Saturday, November 21, 2026

Idiomdrottning

MPD as shell event driver

Here is a shell script for having the Music Player Daemon trigger events. It shells out to mpc and this example config also shells out to kasa, a lamp control app. In the example, each album in the playlist has its own mood lightning. You can get fancy and add --transition flags, perhaps starting the transition by %position% of the previous album’s last song and prepending a sleep such-and-such-many seconds; rather than by %album%.The script is meant to run in the background or with dtach or systemd until mpc’s event listener hears from MPD.In the past I’ve used MPD as a soundboard backend when DM-ing and if it can also control lights (more subtly than in this example) I might want to dust that off.#!/bin/sh # Put any pre-loop commands here such as exports and any initial # settings you want before the sound starts playing export KASA_USERNAME="your kasa email" export KASA_PASSWORD="your kasa password" export KASA_HOST="your kasa IP" while true; do pos=$(mpc -f %position% current) album=$(mpc -f %album% current) case "$pos" in 2) kasa brightness 100 ;; esac case "$album" in "Veil of Imagination") kasa hsv 120 100 80 ;; "The Fierce and the Longing") kasa command set_device_info '{"color_temp": 4500, "brightness": 20}' ;; "When I Die, Will I Get Better?") kasa hsv 200 40 85 ;; "Still Life (Remastered)") kasa hsv 0 100 50 ;; esac mpc idle player done For a repo of this example script,git clone https://idiomdrottning.org/kasampd

by Idiomdrottning at Saturday, November 21, 2026

Thursday, November 19, 2026

spritely.institute

Lisp Game Jam devlog: Polydraw

This year's Autumn Lisp Game Jam has just wrapped up! Spritely's contribution to the jam was Polydraw, a peer-to-peer party game that is easy to pick up and play with friends. In Polydraw, players take turns being the artist who draws an image based on a prompt. The catch is that the artist only has 60 seconds and can only draw using triangles. All of the other players are guessers who try to correctly guess the prompt. We're quite pleased with how the game turned out!

The rest of this post is a daily devlog of how we made Polydraw so you can see what the process look likes to make a game with Goblins and Hoot under a tight deadline.

Day 1 (10/30)

It's go time! First, we created a Git repository on Codeberg and copied the Hoot game jam template into it.

Since the core activity in Polydraw is drawing triangles, the first thing Dave implemented was an interface for doing that on a canvas. This first version was crude and didn't include a color picker.

Day 2 and 3 (10/31 and 11/1)

We took the weekend off to prepare for a busy week ahead.

Day 4 (11/02)

This is the day that we really got to work on the game jam.

The first version of the triangle editor stored pixel coordinates of the local canvas, but that wasn't going to be good enough to display on other machines with different sized canvases. So, Dave simply normalized triangle vertices into the [0,1] range so each peer could scale them as needed.

Dave also implemented a basic scene system, a common game programming pattern, to encapsulate the coarse game states such as the title screen, the lobby, and the main game.

A color palette was added along with some additional mockup UI around the canvas.

Day 5 (11/03)

With a good enough game engine in place, we turned our attention to the game protocol. Since we are using Goblins, all interactions are modeled using actors. Dave came up with the following actors:

  • Player: Used for player identity within the game and contains the player's self-proposed name.

  • Lobby: The place where players gather before the game starts. The player that creates the lobby is the host and all other players are guests.

  • Game: Holds all of the game state like the player list, whose turn it is, and the scoreboard.

  • Controller: A player's virtual game controller. Used to speak to the game actor, but all actions are scoped to the individual player.

A test script was written to simulate creating a game, joining the lobby, and playing a round. At this stage, everything was happening in a single process. Goblins makes it easy to start with a single process and then distribute the actors to multiple machines later.

Day 6 (11/04)

Now it was time to get the actors onto the network and hook them up to the game UI. For networking we used OCapN, naturally. Jessica started up an instance of our new end-to-end encrypted relay netlayer that we set as the default relay so the game would "just work" when we uploaded it to itch.io. In fact, dogfooding the relay was a large part of the motivation behind participating in the game jam in the first place!

Dave got the actors online with OCapN and connected the game UI to the actors, then confirmed that a three player game works. Three players is the minimum number of players needed to trigger OCapN's third-party handoff feature. Handoffs are what enable distributed networking in OCapN: Alice can give Bob a reference to Carol, which causes Bob and Carol to establish a new OCapN session with each other. This is the first application we've made that does handoffs over the relay netlayer and it was nice to see them working as intended.

Unfortunately, we discovered an issue with how Goblins handles two peers connecting to each other concurrently, a problem known as "crossed hellos". OCapN mandates that only one connection may be open between any two peers, so we have to pick which connection wins. The bug is that any promises that were created over the losing connection never resolve. This was observed in the game as an empty lobby player list that should be populated. It didn't prevent the rest of the game from working, though, so we didn't try to fix it (yet).

Day 7 (11/05)

On this day, Dave discovered that, despite his best efforts, he fell victim to the "identity footgun". We could write a whole blog post series about the many subtle issues of object identity (in the sense of Scheme's eq?) in object capability systems, but instead we'll refer you to the The Grant Matcher Puzzle and just mention that using object references as keys in associative data structures is error-prone. A promise that eventually resolves to a reference to Alice is not identical (again, in the eq? sense) to a reference to Alice. So, if you accidentally use a promise as a key somewhere or use eq? directly you will probably have a bad time, which is exactly what happened to us.

To deal with this identity crisis, Dave first detected it at runtime by writing a wrapper around eq? called geq?. This new predicate throws an error when comparing a promise to a non-promise. Then he used the resulting backtraces to find the offending code and change it to resolve all necessary promises before doing identity comparisons.

Christine finally cleared enough other things off her plate where she could start contributing to the game. We thought it would be nice to have the game start with a splash screen of triangle'y animations that would resemble the kinds of art players would make in the game. We decided to use the Blender add-on by Ursula Kurdali named Stop Motion since it gives a great amount of freedom to animate by creating and destroying as much geometry as you like. Christine made the first mockup of a splash screen animation of a "death" type character swinging a scythe.

However, the animation hadn't left Blender yet. We're gonna have to figure out how to get those polygons out and into the game engine!

Day 8 (11/06)

This was the day to finish implementing the core game loop. We wanted the weekend to be all about fixing bugs and making it look and feel as good as we can. At last, the points awarded at the end of each round were displayed in the UI. The player list on the left side of the screen was transformed into a leaderboard that sorted players by score.

While creating the leaderboard it was discovered that Goblins was not correctly parsing pairs received over OCapN. Christine swooped in with a quick fix and Jessica folowed up with a regression test.

We also added a small set of emoji reactions underneath the leaderboard. Reactions were not critical to the core gameplay but they were planned from the very beginning of the project. It's good that we had time to add them because it was a lot of fun to spam emojis at the artist to give them an indication of how good or bad they were doing.

Day 9 (11/07)

With two days left and the core gameplay loop complete, the focus shifted to bug fixing and adding juice. Up until this point the HTML was mostly unstyled (as you can see in the videos above), so Dave added a little CSS to improve the look and feel.

A playtest revealed that the simple PRNG we were using was implemented incorrectly. We noticed because the artist prompt was always "bus" no matter how many rounds you played. Oops! This was fixed.

Remember that crossed hellos bug from day 7? Dave finally implemented a workaround, which was to simply throw out the first pancake and try again, as suggested by Christine. A simple race against a timeout was all that was needed. We'll be thinking about how to fix this in Goblins so this situation cannot happen in the future.

Christine started work on making more animations for the game's intro. The "death" animation was a good "hello world" for testing the exporter, but being all black it was too simple to make sure everything worked right; draw order, etc, didn't matter. Christine made a "square guys" animation as a kind of Acid2 test equivalent. This file had several tricky properties to it, most especially that draw order would matter, colors would be important, et cetera.

Christine also made this triangle'y duck themed piece:

Christine wrote a Python script to export the animations from Blender into a custom format encoded using Syrup. The encoded data was then embedded into the Scheme program as bytevector literals using a little script. Dave then started work on a renderer for these animations, but it wasn't working quite well enough by the end of the day to commit and push it.

Up until this point we only had a small number of frequently-repeated words. Morgan Lemmer-Webber curated a word list for us, starting with an existing public domain word list of 5000 words, and curated down to a 621 words, selecting for words that were more feasible to draw (ranging from easy to challenging, but all trying to be feasible).

The game name was changed from the placeholder "Twenty Triangles" to "Polydraw".

Day 10 (11/08)

The final day.

The code to render animations was finished. Some final minor bug fixes were made. Some CSS was tweaked. Original music and sound effects by encrypted.whispers were added. Additionally, we used a few CC0-licensed sound effects by Kenney.

A few gameplay improvements were made, such as showing guessers what the prompt was when the round ends and how many triangles the artist had remaining. Little improvements can make a big difference and both of these changes were very helpful for players and made the game feel more polished.

There wasn't enough time remaining to do as much work on resiliency in the face of network partitions as we would have liked, but Dave did squeeze in a commit that allowed the game to survive if a guest leaves. Unfortunately, the experience for the disconnected guest isn't very good as they don't see any message that their connection dropped.

We did a final playtest to confirm that there weren't any showstopper bugs. Christine added final splash animations.

Finally, Christine added some code (fixed up by Dave) and animations which would overlay over the drawings indicating that drawing was starting, it was time to guess, or the results.

Pencils down!

We submitted the game two hours before the deadline! Now it was time to catch our breath and show off the game to everyone we could. Dave even played it live with a couple other people on a stream! Here's a screenshot which gives you a good look of the final result:

The response was quite positive! The feedback we received closely matched the things we wanted to improve upon if we had more time: better disconnect handling, a way for the host to skip to the next phase instead of being forced to wait for the timer to run out, and invite URLs (rather than URIs) that auto-join the game when visited.

Polydraw ranked 5th overall in the official game jam results.

Try playing it over on itch.io and leave us a comment!

Thanks to our supporters

Your support makes our work possible! If you like what we do, please consider becoming a Spritely supporter today!

Diamond tier

  • Aeva Palecek
  • David Anderson
  • Holmes Wilson
  • Jonathan Frederickson
  • Lassi Kiuru

Gold tier

  • Alex Sassmannshausen
  • Juan Lizarraga Cubillos
  • Nerine Pekowsky
  • Serra Allgood

Silver tier

  • Austin Robinson
  • Brit Butler
  • Charlie McMackin
  • Dan Connolly
  • Deb Nicholson
  • Diana Thayer
  • Eric Bavier
  • Eric Schultz
  • Evangelo Stavro Prodromou
  • Evgeni Ku
  • Glenn Thompson
  • James Luke
  • Jonathan Smith
  • Jonathan Wright
  • Justin Sheehy
  • Matt Panhans
  • Michel Lind
  • Mike Ledoux
  • Nathan TeBlunthuis
  • Nia Bickford
  • Noah Beasley
  • Steve Sprang
  • Travis Smith

Bronze tier

  • Alan Zimmerman
  • Aria Stewart
  • Ben Hamill
  • Benjamin Grimm-Lebsanft
  • Brooke Vibber
  • Brooklyn Zelenka
  • Carl A
  • Crazypedia No
  • Ellie High
  • Elliot Martin
  • François Joulaud
  • Gabor Udvari
  • Grant Gould
  • Gregory Buhtz
  • Ivan Sagalaev
  • James Smith
  • Jason Wodicka
  • Jeff Forcier
  • Marty McGuire
  • Mason DeVries
  • Michael Orbinpost
  • Neil Brudnak
  • Nelson Pavlosky
  • Nicholas Farley
  • Philipp Nassua
  • Rodion Goritskov
  • Ron Welch
  • Stefan Magdalinski
  • Stephen Herrick
  • Steven De Herdt
  • Tamara Schmitz
  • Thomas Talbot
  • William Murphy
  • Yoshua Wakeham
  • a b
  • chee rabbits
  • r g
  • terra tauri

by Dave Thompson, Christine Lemmer-Webber at Thursday, November 19, 2026

Saturday, November 14, 2026

Scheme Requests for Implementation

SRFI 289: Unordered sets and bags

SRFI 289 is now in draft status.

Sets and bags (also known as multisets) are unordered collections that contain only objects of a type given by a collection’s SRFI 128 comparator. Every element of a set is unique (in the sense of the set’s comparator), but bags can contain any number of duplicate elements. This SRFI is a revision of SRFI 113 that fixes several infelicities and is more consistent with related SRFIs.

by Wolfgang Corcoran-Mathe (text and test suite), Peter McGoron (sample implementation), and John Cowan (author of SRFI 113) at Saturday, November 14, 2026

Sunday, November 1, 2026

Scheme Requests for Implementation

SRFI 272: Pretty Printing

SRFI 272 is now in final status.

This SRFI follows the traditional Scheme model of pretty printing, which treats it as a process distinct from general controlled formatting. While general-purpose formatters often prioritize specialized presentation at the expense of machine-readability, Scheme’s pretty-printers (such as those of SLIB and MIT Scheme) have traditionally treated pretty printing as a variant of write, differing primarily in the insertion of whitespace to make the presentation more palatable to humans. Common Lisp’s pretty-printer, by contrast, fills two roles simultaneously by integrating pretty printing with both its format facility and its generalized write procedures. This unified approach offers great power, but at the cost of complexity that can make it difficult to use effectively. We propose a specialized, layered approach, specifying five libraries of increasing functionality, where all but the first are optional. The libraries are downward-compatible: more powerful libraries satisfy all requirements of the simpler ones while adding new features. Implementors may choose to support a maximum level of functionality appropriate for their systems. Integration with monadic and string-based formatting libraries is supported.

by Sergei Egorov at Sunday, November 1, 2026

Thursday, October 29, 2026

Scheme Requests for Implementation

SRFI 279: In(tro)spection Protocol

SRFI 279 is now in final status.

Interactive REPL-driven systems (that most Schemes are) need a way to get detailed information on a given piece of data. Inspectors, as these are conventionally called. This SRFI defines a basic protocol for inspectors, consisting of three procedures: inspect-properties, inspect-property, and inspect-describe. Some suggestions for standard and popular types’ inspection are also provided.

by Artyom Bologov at Thursday, October 29, 2026

Wednesday, October 28, 2026

spritely.institute

Hoot 0.10.0 released!

We are excited to announce the release of Hoot 0.10.0! Hoot is a Scheme to WebAssembly compiler backend for Guile, as well as a general purpose WebAssembly toolchain. In other words, Scheme in the browser!

This release contains new features and bug fixes and since the 0.9.0 release back in May.

Use Hoot in the upcoming Lisp Game Jam!

On Friday (October 30th 2026), the autumn edition of the Lisp Game Jam will begin! It's a 10-day long game jam where participants make games using their favorite flavor of Lisp.

Does making a small web game in Scheme using Hoot sound appealing to you? Well, then we have just the thing to get you started: the Hoot game jam template! This template project has everything you need to start making an HTML5 game with Hoot quickly.

The template repository includes:

  • Bindings to the necessary web APIs to make an interactive game with HTML5 canvas

  • A Makefile for compiling, running a development web server, and generating a .zip bundle for uploading to itch.io

  • A very simple Breakout-like example game that demonstrates how to put all the pieces together

For more inspiration, here are some games made with Hoot for past jams:

Now, onto the release notes!

Compiler changes

  • Added module name to contextualize duplicate import errors.
  • Added support for library versioning for R6RS compatibility.
  • Fixed default version for define-module libraries.
  • Fixed locate-library not respecting configured load extensions. Previously, we were using Guile's load extension parameter instead of Hoot's own.

Runtime changes

  • Added %struct-ref and %struct-set! primitives for accessing record types defined using the interpreter.
  • Stopped raising errors when importing an undefined symbol in the runtime module system. Guile is lax about this so Hoot being strict caused compatibility issues.
  • Fixed optional argument parsing in primitive-eval.
  • Fixed keyword argument parsing for procedures with both optional and keyword arguments in primitive-eval.
  • Fixed error messages regarding runtime module registry to include the correct CLI flag: -fruntime-modules.

Scheme changes

  • Added partial implementation of SRFI-13: String Libraries. It's just a set of re-exports, very similar to Guile, but Guile's SRFI-13 module is not declarative and is thus rejected by Hoot's compiler.
  • Added partial implementation of SRFI-60: Integers as Bits.
  • Added define-macro, defmacro, delete, list->symbol, and symbol to (guile).
  • Exported define-syntax-parameter and syntax-parameterize, symbol-append, integer-length, and gensym from (guile).
  • Added list->bitvector and bitvector to (hoot bitvectors) and re-exported them in (guile).
  • Implemented get-bytevector-all in (rnrs io ports).
  • Made bytevector=? a publicly exported procedure from (hoot bytevectors) and (rnrs bytevectors).
  • Added define-syntax-parameter and syntax-parameterize primitives.
  • Improved (ice-9 exceptions) exports to more closely match Guile.
  • Added (rnrs) module.
  • Added (rnrs base) module.
  • Added (rnrs syntax-case) module.
  • Added (rnrs r5rs) module.
  • Added (rnrs hashtables) module.
  • Added (rnrs files) module.
  • Added (rnrs enums) module.
  • Added (rnrs exceptions) module.
  • Added (rnrs arithmetic fixnums) module.
  • Added (rnrs records inspection) module.
  • Added (rnrs records procedural) module.
  • Added (rnrs records syntactic) module.
  • Added (rnrs io simple) module.
  • Added (rnrs io ports) module.
  • Added port-has-position? to (hoot ports) for R6RS compatibility.
  • Added stubs for centered division to (hoot numbers) and a stub for integer-length to (hoot bitwise) for R6RS compatibility (eventually).
  • Rewrote (rnrs bytevectors) as an R6RS module with version (6).
  • Fixed number->string to round floating point decimal part to an even digit.
  • Fixed number->string for floating point numbers ±2^N, where 52 <= N <= 1023.
  • Fixed incorrect bytevector copy in number->string floating point conversion algorithm.
  • Fixed min/max macros not working when given zero arguments.
  • Fixed the parameters to the log procedure in (guile).
  • Fixed the implementation of negate in guile. It was doing entirely the wrong thing.

CLI changes

  • Port numbers are now validated to be exact integers in the range [1, 65535].
  • Actually complain about invalid option or unknown subcommand. Previously, the code that was supposed to do this was unreachable.
  • Add --experimental-wasm-exnref feature flag when running hoot compile --run=node for continued compatibility with supported NodeJS versions that don't have the new Wasm exnref feature enabled by default.
  • Fixed build-time disabling of hoot server. In past releases, the hoot CLI script would still attempt to load should-be-optional libraries that ./configure had already determined to be missing. Thanks to mcc for discovering this blunder.

Documentation changes

  • Improved instructions in "Building from source" section of the manual.
  • Dependencies are now mentioned in the "Advanced path" section of the README.
  • Updated project template README to say Guix is not required (though it's still the easiest option).

Browser compatibility

  • Compatible with Safari 26 or later.
  • Compatible with Firefox 121 or later.
  • Compatible with Chrome 119 or later.

Get Hoot

Hoot is available in GNU Guix:

$ guix pull
$ guix install guile guile-hoot

Also, Hoot is now available in Debian, though it will take awhile for this release to make it there.

Otherwise, Hoot can be built from source via our release tarball. See the Hoot homepage for a download link and GPG signature.

Documentation for Hoot 0.10.0, including build instructions, can be found here.

Get in touch

For bug reports, pull requests, or just to follow along with development, check out the Hoot project on Codeberg.

If you build something cool with Hoot, let us know on our community forum!

Thanks to Z572, stdh, Walter Lewis, and Jelle Licht for their contributions to this release.

Until next time, happy hooting! 🦉

Thanks to our supporters

Your support makes our work possible! If you like what we do, please consider becoming a Spritely supporter today!

Diamond tier

  • Aeva Palecek
  • David Anderson
  • Holmes Wilson
  • Jonathan Frederickson
  • Lassi Kiuru

Gold tier

  • Alex Sassmannshausen
  • Juan Lizarraga Cubillos
  • Nerine Pekowsky
  • Serra Allgood

Silver tier

  • Austin Robinson
  • Brit Butler
  • Charlie McMackin
  • Dan Connolly
  • Deb Nicholson
  • Diana Thayer
  • Eric Bavier
  • Eric Schultz
  • Evangelo Stavro Prodromou
  • Evgeni Ku
  • Glenn Thompson
  • James Luke
  • Jonathan Smith
  • Jonathan Wright
  • Justin Sheehy
  • Matt Panhans
  • Michel Lind
  • Mike Ledoux
  • Moto A
  • Nathan TeBlunthuis
  • Nia Bickford
  • Noah Beasley
  • Steve Sprang
  • Travis Smith

Bronze tier

  • Alan Zimmerman
  • Aria Stewart
  • Ben Hamill
  • Benjamin Grimm-Lebsanft
  • Brooke Vibber
  • Brooklyn Zelenka
  • Carl A
  • Crazypedia No
  • Ellie High
  • François Joulaud
  • Gabor Udvari
  • Grant Gould
  • Gregory Buhtz
  • James Smith
  • Jason Wodicka
  • Jeff Forcier
  • Marty McGuire
  • Mason DeVries
  • Michael Orbinpost
  • Neil Brudnak
  • Nelson Pavlosky
  • Philipp Nassua
  • Rodion Goritskov
  • Ron Welch
  • Stefan Magdalinski
  • Stephen Herrick
  • Steven De Herdt
  • Tamara Schmitz
  • Thomas Talbot
  • William Murphy
  • a b
  • chee rabbits
  • r g
  • terra tauri

by Dave Thompson at Wednesday, October 28, 2026

Monday, October 26, 2026

Scheme Requests for Implementation

SRFI 242: The CFG Language

SRFI 242 is now in withdrawn status.

This SRFI defines a language to describe control-flow graphs (CFGs) suitable for formulating iterative and recursive algorithms. Using the notion of a CFG term, this language can be seamlessly embedded in the Scheme language. Complex CFG terms can be composed from simple CFG terms.

by Marc Nieper-Wißkirchen at Monday, October 26, 2026

SRFI 265: The CFG Language

SRFI 265 is now in final status.

This SRFI defines a language to describe control-flow graphs (CFGs) suitable for formulating iterative and recursive algorithms. Using the notion of a CFG term, this language can be seamlessly embedded in the Scheme language. Complex CFG terms can be composed from simple CFG terms.

The language described in this SRFI is not meant to be directly used in programs but by library authors to build abstractions like loop facilities on top of it.

by Marc Nieper-Wißkirchen at Monday, October 26, 2026

Sunday, October 25, 2026

Scheme Requests for Implementation

SRFI 288: Compound Conditions

SRFI 288 is now in draft status.

A condition object system is introduced that attempts to be implementable in and interoperable with many implementation’s condition systems, including the condition system of the R6RS. The condition system includes compound conditions, but does not include subtyping of conditions. Simple conditions can be any implementation-defined value, and are also objects that can be made with the interface in this SRFI. An implementation may add other features, such as introspection and serialization.

by Peter McGoron at Sunday, October 25, 2026

Gwen Weinholt

Akku.scm 1.2.0 released

Akku.scm version 1.2.0, the language package manager for R6RS and R7RS Scheme, is now generally available. It can be downloaded from GitLab. The most important change is a fix to the dependency solver, which was running very slowly due to a bug triggered by the many versions of the chez-srfi package.

Akku is a project-based package manager, where each project has its own set of dependencies. You use .akku/env to set shell variables that let your Scheme implementation know where to find everything.

You can upload your own packages to the archive. They go through a review process to ensure nothing malicious is distributed.

Akku also performs automatic conversion from the R7RS define-library form to the R6RS library form. This lets, e.g., Chez Scheme use R7RS libraries. Packages from the Snow package manager, which has many R7RS packages, are also available via Akku.

Further reading

by weinholt at Sunday, October 25, 2026

Saturday, October 24, 2026

jointhefreeworld

Emacs finally folds to my liking

I’ve been slowly turning my Emacs config into something I actually enjoy using, not just something that works, and folding was the last place where that wasn’t true.

Every mode had its own idea of what folding is: treesit-fold in Tree-sitter modes, Hideshow in the Lisp-ish ones, Outline in everything that resembles text, Org with its own invisible text that no one else’s commands can undo.

So every buffer had different keys, a different look, and worst of all different performance characteristics. Folding a big file sometimes felt like holding my breath.

I’m running Emacs 32.0.50 from master (built from source, as one does), and it’s finally one system.

kirigami is the piece I didn’t know I needed  #

kirigami doesn’t fold anything itself. It dispatches: it keeps a list of folding engines, checks which one is actually active in the buffer, and forwards to it. Tree-sitter, Hideshow, Outline, Org, Vdiff — all behind one interface.

So on top of it I put one set of keys, the same in a Kotlin buffer, YAML, a Scheme or ELisp buffer and an Org file:

Key Does
C-c v c close this fold
C-c v C close every fold
C-c v o open this fold
C-c v O open this fold and everything under it
C-c v r reveal everything
C-c v t toggle the fold at point

That sounds small. It is not small. The number of times a day I used to think “wait, what does TAB do in this mode again” is now zero, and the muscle memory transfers across an entire polyglot config.

One wrinkle worth mentioning: kirigami answers with the first engine in its list whose mode is on, and outline-minor-mode is on in nearly every buffer I have. In the buffers where I deliberately turned on Hideshow — Scheme, for instance — that choice has to win, otherwise C-c v c folds “headings” a Scheme file doesn’t have. So I reorder kirigami-fold-list to put Hideshow first instead of rewriting it; engines kirigami adds later still get used wherever Hideshow is off.

Tree-sitter folding, with guides that are actually lines  #

Most of my programming buffers are *-ts-mode, so treesit-fold does the work there — bash, C, C++, CMake, CSS, Dockerfile, Elixir, Go, HTML, Java, JS/TS/TSX, JSON, Kotlin, Lua, Nix, PHP, Python, Ruby, Rust, Scala, TOML, YAML. Line counts are shown inline, which I find genuinely useful when deciding whether to open a fold.

The indicators took the most fiddling. treesit-fold-indicators draws a block’s guide with a bitmap 23 rows tall, centered in the line beside it. A line in my config is 29 pixels — the font’s 23 plus six of line-spacing — so every row of the guide was a 23-pixel dash with three pixels of nothing above and below it. A folded block looked like a dotted line running down the fringe. Not subtle, just wrong.

There’s no setting for that, so I replaced the bitmaps: a single-row bitmap that define-fringe-bitmap repeats down however tall the line is (no spacing can introduce a gap), plus a +=/-= box and an end-elbow cut to the exact height of a line, so the guide runs from the marker into the row below and turns toward the text where the block ends. It’s an advice on the function that builds the string for each line. It looks like a bracket now, not a perforation.

And the colour: the indicators inherited shadow, which most themes make as bright as a comment. Fine for one marker on one line, wrong for a marker on every line of a block — the grey became a rule drawn through the code. They’re now shadow blended 50% toward the theme’s background, recomputed on every theme and scale change, so it fades correctly on light themes too and no theme needs a special entry.

Hideshow earns its keep  #

Not everything has a grammar, and I’m not going to pretend otherwise:

  • Scheme — my Emacs build has no Scheme grammar, so Scheme buffers use Hideshow with hs-block-start-regexp set to "^(" and hs-forward-sexp-function set to forward-sexp. A Scheme file is a sequence of top-level forms, so each definition is a fold, and collapsing the one you’re inside works from anywhere within it. That’s the behaviour I wanted from the start and Hideshow doesn’t guess it by default.
  • Emacs Lisp — the prog-mode fallback, same keys.
  • XML — folds from start tag to end tag using nxml-scan-element-forward, skipping , comments, DOCTYPE and self-closing elements.
  • YAML (the non-Tree-sitter mode) — indentation-based blocks with a small forward-sexp of my own that walks to the end of the indented block.

Hideshow’s own fringe indicators ( hs-show-indicators + hs-indicator-type 'fringe) are on in all of these, so it doesn’t feel like a downgrade from the Tree-sitter buffers.

The rule I enforce per buffer is exactly one set of indicators: Tree-sitter buffers get treesit-fold and Hideshow is turned off; Hideshow buffers get Hideshow and Outline’s clickable buttons are turned off so the two don’t double up; outline-only buffers (Markdown, diff) keep the buttons. Nobody ends up with two markers per block.

Org, which needed its own everything  #

Org folds with text properties, not overlays, so neither Tree-sitter nor Hideshow nor Outline’s buttons can draw a marker for it. So I wrote its own indicators: a fringe triangle pointing down for an open heading, right for a folded one, clickable with mouse-1 to toggle exactly like TAB. Folding itself is untouched — TAB, S-TAB and the C-c v keys all still work.

The performance part is where the real win is. A naive “redraw indicators after every command” implementation is a disaster in a large file, because it re-searches the buffer and rebuilds every overlay on every pause. Mine is driven by the text instead:

  • if buffer-chars-modified-tick didn’t change, only the indicators that are on screen are redrawn — off-screen headings can wait until they’re scrolled to;
  • if it changed and the change was recorded, only the dirty region is rebuilt;
  • if it changed with no recorded change, only then is the whole buffer rebuilt.

Folding changes text properties rather than characters, so folding alone takes the cheap path. Fold state is read back from Org on each redraw rather than remembered, so external folding can never leave a stale marker.

Two config choices matter just as much: org-fold-core-style is text-properties (so a visibility cycle doesn’t re-parse the file), org-element-use-cache is on, and Org starts with showeverything — which is both what I want (a note is read, not consulted) and the cheaper state, because it skips the visibility passes that walk every heading on open. I also removed a org-restart-font-lock that was re-fontifying the whole buffer a second time on open; JIT-lock handles what’s on screen.

It feels smooth, and that’s the whole point  #

The end result is that folding is boring now. C-c v c in Kotlin, Scheme, Elisp, Org, XML, YAML, Markdown. Guides that look like brackets. Indicators quiet enough to ignore until you need them. No pause on a 3000-line Org file. No two competing markers.

It honestly changes how much I collapse and expand while reading code. I used to avoid folding because it felt fiddly; now it’s free and mouse friendly.

If you want to read the actual code: it’s in dev-folding.el for the engines and indicators, the heks/fold-* wrappers in heks-emacs.el for the keys, and the Org indicators live in org.el. Everything is GPL-3.0, and it’s tested: maak verify asserts a fold actually covers a whole definition and that the documented keys are bound, and maak keys fails on a key that does two jobs or names a command that doesn’t exist.

Happy to answer questions about any of it, especially if you’ve fought the treesit-fold-indicators bitmaps yourself, because that one cost me an evening and I’d love to know if there’s a cleaner way.

Saturday, October 24, 2026