Skip to content

Namespace load-state indicator in the mode line#3973

Draft
bbatsov wants to merge 1 commit into
masterfrom
feat-ns-load-state
Draft

Namespace load-state indicator in the mode line#3973
bbatsov wants to merge 1 commit into
masterfrom
feat-ns-load-state

Conversation

@bbatsov

@bbatsov bbatsov commented Jun 18, 2026

Copy link
Copy Markdown
Member

Make it obvious, without running anything, whether the buffer you're looking at is actually loaded into the REPL.

The cider-mode lighter grows a small marker:

  • not-loaded - this namespace isn't loaded in the running REPL (operating on it will likely misbehave).
  • stale - the buffer has been edited since it was last loaded via CIDER.

How it works:

  • State is cached buffer-locally (cider--ns-loaded plus a buffer-chars-modified-tick baseline) and the lighter only reads that cache, so redisplay never touches the network.
  • It's refreshed when CIDER loads a file (cider-file-loaded-hook), on demand via M-x cider-ns-refresh-load-state, and once per buffer when you first focus it (window-selection-change-functions).
  • No query on connect: a cider/ns-list request fired during the connection dance breaks the mock-server tests, and focus-driven refresh is nicer UX anyway.
  • Toggle the whole thing with cider-show-ns-load-state.

Known limitations (intentional for now):

  • stale only works for namespaces CIDER itself loaded - if a namespace was loaded outside CIDER (or before it attached) there's no reliable sync baseline, so it shows as loaded and never goes stale.
  • Granularity is the whole namespace, not per-form. Per-form staleness (extending the fringe indicators) is a separate effort.

Opening this as a draft to gather feedback - the markers, triggers and defaults are all up for discussion.

Surface, right in the `cider-mode` lighter, whether the current buffer's
namespace is actually loaded into the REPL and whether it's still in sync
with what was loaded. The lighter shows ` not-loaded` for a namespace the
runtime doesn't know about and ` stale` once you've edited the buffer since
the last load - the common "why is my change not taking effect" trap.

State is cached buffer-locally and never queried during redisplay, so the
lighter stays cheap. It's refreshed when CIDER loads a file, on demand via
`cider-ns-refresh-load-state`, and once per buffer when you focus it. We
deliberately avoid querying at connection time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant