Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional repeat suppression #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

morganwillcock
Copy link

This change introduces an option which allows translated key bindings to avoid being repeated, to be used by Devil or by other packages where the Devil repeat map should not be activated.

Repeat suppression is configured by maintaining a list of functions which are treated as repeat suppression predicates. Interactive functions will not be repeated when their symbol is a list member. Non-interactive functions are called with the binding as the argument and should return a non-nil value when the repeat should be suppressed.

By default the predicate list contains the symbol devil--isearch-suppress-repeat-p which suppresses the repeat of isearch-forward while the isearch specific mode map is not active. This fixes initiating an isearch with the default list of repeatable keys and trying to enter the letter 's' as the search criteria.


I have ended up with this solution as a way to fix problems I was having with C-s being repeated after the isearch search is activated, i.e. it didn't seem possible to enter a search string which began with the letter 's'. I'm not particularly sure on how efficient the test of the active keymap is, but I've not noticed any issues with it so far.

There may be other solutions or more efficient ways to solve this particular problem, but using the list of predicates would also allow other packages to opt their key presses out of being repeated where the activation of the repeat map is problematic.

This change introduces an option which allows translated key bindings
to avoid being repeated, to be used by Devil or by other packages
where the Devil repeat map should not be activated.

Repeat suppression is configured by maintaining a list of functions
which are treated as repeat suppression predicates.  Interactive
functions will not be repeated when their symbol is a list member.
Non-interactive functions are called with the binding as the argument
and should return a non-nil value when the repeat should be
suppressed.

By default the predicate list contains the symbol
devil--isearch-suppress-repeat-p which suppresses the repeat of
isearch-forward while the isearch specific mode map is not active.
This fixes initiating an isearch with the default list of repeatable
keys and trying to enter the letter 's' as the search criteria.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant