Closed martenlienen closed 4 months ago
@martenlienen Thanks for the PR!
Also, if all characters of your directive name were already assigned
Can you give me an example of how this can happen under the current scheme? I'm imagining that a combination (> 2) of similar directive names can lead to this, but I couldn't come up with an example.
Consider the case where you have three directives a
, b
and ab
. When you get to ab
, both characters have already been taken, so it continues to loop until you get
ELISP> (substring "ab" 2 3)
*** Eval error *** Args out of range: "ab", 2, 3
so it would actually error, I believe, instead of assigning no key.
Consider the case where you have three directives
a
,b
andab
. When you get toab
, both characters have already been taken, so it continues to loop until you getELISP> (substring "ab" 2 3) *** Eval error *** Args out of range: "ab", 2, 3
so it would actually error, I believe, instead of assigning no key.
Ah right, thanks for clearing it up.
@martenlienen Thanks for the PR! Merging now.
BTW I think there's one edge case still unaddressed: Consider the directives a
, b
, ab
and c
. Per the current logic,
a
is assigned a
b
is assigned to b
ab
is assigned to c
(the first unused letter)c
is assigned to d
Ideally c
would be assigned to c
and ab
to something else. But I think we can live with this, it's exceedingly unlikely to happen.
At the moment, the transient can assign
h
to one of your directives and then you need to use the mouse to customize directives on the fly. Also, if all characters of your directive name were already assigned, it would not assign any. With this PR, an arbitrary unused key will be assigned instead.