Simplify the mode and make it work correctly with Evil. #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't expect you to merge this, especially since I made some opinionated changes. I'm using this more to communicate an alternate way to attach sounds to the right sorts of commands. The current version makes assumptions -- or at least requires configuration -- about the current movement bindings, and it interferes with some of the self-insert bindings, generally breaking Evil/Spacemacs (#20). Unfortunately there's not really any way for the mode to discover the user's configuration and hook the right things.
The alternate approach in this PR is to hook
post-command-hook
and observe changes to the buffer's state: specifically its size and point position. That way it doesn't matter what commands are bound to what keys. If the buffer changes size, play a typing sound. If instead the point moved, play a movement sound. This also avoids the whole mess with the hash table.The hook function could definitely use more smarts. For example, it can't tell the difference between yanking/pasting and typing. They're both just changes to the size of the buffer. It also makes a huge racket when macros are played back (and for Evil's dot
.
command).