Skip to main content

Module mode

Module mode 

Source
Expand description

M.2.b.2 (2026-06-01): MultibufferMode — the major mode bound to BufferKind::Multibuffer via H.2’s Mode::target_buffer_kind declaration.

Thin major: contributes ReadOnly = true + NoFile = true (M.3 will make ReadOnly conditional once edit propagation lands). Excerpt-jump motion keymap (]e / [e / ]E / [E) arrives in M.2.b.3. Provider-specific behaviour layers on as minor modes (ProjectSearchMode etc., M.6+).

register_multibuffer_modes(®istry, &events, mb_registry) is the single boot-wiring entry point the host calls. It registers MultibufferMode AND wires the Event::DocumentClosed subscriber that removes the closed multibuffer’s entry from the MultibufferRegistry (cleanup contract per multibuffer-views.md §3.7).

See docs/dev/architecture/multibuffer-views.md §3.7.

Structs§

MultibufferMode
Major mode for buffers of [BufferKind::Multibuffer]. Generic; knows nothing about why excerpts exist. Provider-specific behaviour (project-search, lsp-references, etc.) is layered as minor modes registered by each provider’s own register_<provider> helper.
MultibufferModeGuard
M.7 / M.8: deregisters all fold overlay providers when the mode is deactivated. Holds one entry per registered provider (ExcerptFoldProvider + FileBoundaryFoldProvider). Drop fires when the buffer’s major mode is swapped out or the buffer closes. Also drops the generic <CR> jump-to-source action handler registration on deactivation.

Functions§

register_multibuffer_ex_commands
K.2.5 (2026-06-02): register :multibuffer-expand [n] and :multibuffer-contract [n] ex-commands.
register_multibuffer_modes
Boot wiring entry point. Called once from lattice-host’s editor_boot::boot after the ServiceRegistry is populated with MultibufferRegistryHandle and the EventBus exists.