Skip to main content

emacs_keys_layer_bindings

Function emacs_keys_layer_bindings 

Source
pub fn emacs_keys_layer_bindings(
    enabled: bool,
    prefix: &str,
    registry: &CommandRegistry,
) -> HashMap<BindingMode, KeymapTrie>
Expand description

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).

enabled is the :set emacs-keys toggle: false yields an EMPTY Normal trie. The layer is the gate (the mode itself stays a marker), so re-pushing an empty layer on :set noemacs-keys clears the leader live — <C-x> falls through to plain Normal-mode resolution.

Graceful degradation: an unparseable prefix + suffix chord (bad user config) or an unregistered command name skips that binding with a warn! rather than aborting. A wholly-malformed prefix therefore also yields an empty tribute instead of a panic.