rewrite keymap system, introduce transient-like functionality#2100
rewrite keymap system, introduce transient-like functionality#2100mahmoodsh36 wants to merge 48 commits intolem-project:mainfrom
Conversation
|
there are still things to be done such as:
|
d980ec3 to
e3f6d6a
Compare
|
i need to stop the habit of force pushing, lol |
|
i introduced the following "suffix" values for now:
this behavior is customized by setting the value of the suffix to one of those (or to a symbol that is resolved later to a command that is executed). i dont think this belongs in the suffix slot, i think it would be more ideal for a suffix to always resolve to a command, but currently the function 'read-command' which is part of the event/key handler can only resolve a specific key sequence to a single command. currently the behavior of an infix (such as 'choice') is customized by overriding 'prefix-invoke' but this functionality i think belongs in the suffix itself. i have yet to think of a redesign to make this more intuitive. i think the suffix itself shouldnt necessarily hold the special value that decides the behaviors cancel/drop/back, i think that belongs in a different defmethod (call it prefix-behavior) so that a prefix can both resolve to a command and have custom behavior. |
…plicit function suffixes
before this, after typing / and trying to search, the following keys would be interpreted as if they were entered in normal mode instead, and searching functionality was broken. this is more of a bandaid than a fix, i need to rewrite the whole 'undef-hook' thing which i think is annoying and unintuitive
first 3 are done. |
9d5f5ec to
30d4ea5
Compare
c75b9cb to
7e686cc
Compare
7e686cc to
06b58e5
Compare
827ef0f to
feafe41
Compare
the idea of "dynamic" properties/slots that i had before i think was redundant and just overcomplicated things. this is a refactors things. now we just rely on CLOS even for instance-specific "overrides" in keymaps/prefixes.
4026d50 to
a1533e3
Compare
|
whats left to be done:
currently, the keymap structure uses different concepts of a 'hierarchy' for different use cases, such as a hierarchy for keymap precedence, another for keymap inheritance, and another for keymap prefixing. the 3rd is naturally distinct but the first 2 have some form of relation and im thinking of a way to unify them (and possibly turning keymaps into types instead of just instances). i think this is about it. this functionality is already usable even at this stage. |
|
main thing thats left is to rewrite the event loop to make things more "natural". currently suffixes can be lambdas but they should be commands instead. to fix this i'd want the event reading loop rewritten. |


this is very preliminary work. this is an opinionated rewrite of the keymap system that i think makes more sense and is more intuitive.
yet to be handled/written/re-written:
the keymap system now allows for "dynamic" (non-static) keys or keymaps to be bound on-demand. unlike the old implementation which had nested pre-defined hashmaps, the new implementation uses a different data structure but tries to maintain backwards compatibility with the old implementation (atleast for now).
i will be following this PR with more work and documentation/explanations. the goal was to rewrite the keymap system so that things like transient or which-key are a natural consequence of the data structure and are more intertwined with the core (unlike in emacs).