Repository navigation
feat: optional Acme Look/Execute, and :pending-task - #15
Merged
Merged
Conversation
The Acme branch changed buffer-label to prefer :buffer-name over :filename -- a good fix (generated buffers like *Help* and *repl* were all reading as "*scratch*" in that segment), but a global mode-line change with no coverage of its own, and modeline.lg had no test file at all. Pins the precedence rule (:buffer-name > :filename > "*scratch*") plus the modified-marker/color pairing, and the registry contract around it (register/reorder/remove, and nil-or-empty segments dropping out of the frame), so the change stands independently of the Acme feature. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both ops were open-coding the same find-buffer-by-:buffer-name scan over :order, then the same focus-or-add-buffer branch. Factored into find-buffer-by-name plus reuse-named-buffer, leaving the reuse policy -- replace the content (:help regenerates help text) or append to it (:append-named accumulates output blocks) -- as the only difference, passed in as a named fn. replaced-buffer-state is a top-level fn rather than an inline (fn [_ x] x) at the :help call site: an fn literal inside a case branch is the shape CLAUDE.md warns about for let-go's AOT closure hoisting, and there's no reason to sail close to it. Verified with ./build.sh -- 524 fns lowered, no empty-if-then-return-closure pattern anywhere in build/. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
execute-at-point called os/sh inline, so the whole rc run happened between the keystroke and the next frame: the screen sat on the state from *before* the key was pressed, with nothing saying why. Same shape as the existing M-! shell-command, but F7 invites longer commands. Adds the workspace-shared :pending-task field for exactly the thing a pure (fn [state] -> state) command can't say: "do this slow thing, but let the screen catch up first." A command returns a message plus a task; main.lg's loop paints that frame and then runs the task in place of reading a key. The task is itself a (fn [state] -> state) threaded through the same bufs/put-current fold, so it can set a :buffer-command, and dropping the field from the flat state is what consumes it -- a task may arm a further task, which is the seam an actual async job model would grow from (poll a running process across iterations without any layer below main.lg learning what a process is). execute-at-point now shows "Execute: running <cmd> ..." while rc runs. It still runs to completion before the next key is read; this only fixes the frozen-frame half, which is the visible half. execute-task is a named fn building the closure so execute-at-point's if-let branch contains a call, not an fn literal -- the CLAUDE.md AOT hazard. Tested via ./build.sh; lowers cleanly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A command that has to block (Acme Execute, vibe, anything later) arms the same shared field rather than growing a per-feature hook in main.lg. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
find-buffer-by-name, modeline tests, visible blocking via:pending-task).:pending-taskis the one deferred-work seam: a command that would freeze the editor returns a message plus(fn [state] -> state),main.lgpaints that frame, then runs the task in place of reading a key. Vibe (Experiment: (vibe "...") — LLM code generation spliced in place #5) will use this same field rather than a second hook.Supersedes #3.
Test plan
lg test/run.lg(322 tests, 1395 assertions)+Errorsbuffer reusesExecute: running ...before output appearsMade with Cursor