Skip to main content

Module emacs_keys_mode

Module emacs_keys_mode 

Source
Expand description

emacs-keys-mode — a default-on builtin minor mode contributing an emacs-style <C-x> leader (a tribute layer). Design: docs/dev/architecture/emacs-keys.md; sequencing: docs/dev/operations/slice-plans/emacs-keys.md.

§Home (BC.5, 2026-06-23)

Moved here from lattice-host and reclassified as a builtin mode: it is default-on + Universal, has no owning feature crate, and is renderer-agnostic — so it belongs with the foundation modes in lattice-mode (registered via register_foundation_modes). All the keymap-trie types its layer builder needs (KeymapTrie / BoundCommand / KeymapLayer from lattice-keymap, ChordPattern from lattice-protocol, CommandRegistry / CommandInvocation from lattice-grammar) live below lattice-mode, so the whole module moves. The host retains only the keymap-layer push (it owns the live KeymapHandle + reads config for the prefix / enable flag), calling emacs_keys_layer_bindings here.

§Shape

A marker minor mode (Guard = ()) with ActivationPolicy::Universal, so it auto-activates on every buffer. Its keymap layer is pushed once at boot under MinorMode(emacs-keys-mode); K.1.c’s per-keystroke filter gates the chords to buffers where the mode is active — the diff-mode pattern.

§Configurable prefix

Every binding’s chord is prefix + suffix, parsed as one key sequence ([lattice_protocol::parse_chord_sequence]). The prefix defaults to "<C-x>"; rebuilding the layer with a different prefix re-targets the whole tribute. A malformed prefix (user config) or an unknown command name skips that one binding with a warning — never a panic on the boot path (graceful-degradation contract).

Structs§

EmacsKeysMode
The emacs-keys minor mode. A marker mode: it owns a keymap layer and an activation policy, but allocates no per-buffer resources.

Functions§

emacs_keys_layer_bindings
Build the emacs-keys keymap layer for the given enabled flag and prefix, resolving each binding’s command name against registry. Returns the per-mode trie map the host pushes under MinorMode(emacs-keys-mode).
register_emacs_keys_mode
Register emacs-keys-mode against registry. Called from register_foundation_modes — it is a builtin, so there is no separate boot call.