countvajhula / countvajhula/lithium

Make unbound keys a no-op by default

Open
#3 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Emacs Lisp
Stars
14
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Unbound keys in a Lithium mode should be no-ops rather than fall through to handling by lower level keymaps like `global-map` (e.g., causing self-insertion into the buffer in common cases).

One option is to use Hydra's approach of defining a pre-command hook and mutating `this-command` if the key isn't bound in the current lithium mode map. This seems brittle, as, by this point, key lookup has already concluded and identified a command to run *in some other keymap*. It is *about to run that command*, and we intercept it there and prevent it from doing so. It's a roundabout way of doing it that might break some assumptions in extensions and other tools (e.g., I would be nervous about whether it would break repeat parsing by [Symex](https://github.com/drym-org/symex.el) for its `.` command, which parses actions at the `pre-command` and `post-command` stages using [`mantra`](https://github.com/countvajhula/mantra) and [`repeat-ring`](https://github.com/countvajhula/repeat-ring)). As Lithium is designed to be a *persistent* UI, it would be ideal to have a more direct (and therefore, robust) solution, such as a way to *terminate key lookup* on encountering an unbound key, or *bind a default command* for any unbound key.

Creating this issue as a place to collect ideas for the implementation.

Please see drym-org/symex.el#172 for context.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the issue discussion and the linked symex.el#172 context, then examine the mentioned Hydra approach and how Emacs key lookup interacts with pre-command and post-command processing. Compare options for terminating lookup or binding a default command without disrupting Symex, mantra, or repeat-ring. Done means unbound keys in a Lithium mode are no-ops by default through a direct, robust mechanism.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs-lisp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.