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

Simplify the mode and make it work correctly with Evil. #21

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

Simplify the mode and make it work correctly with Evil. #21

wants to merge 1 commit into from

Conversation

skeeto
Copy link

@skeeto skeeto commented Apr 21, 2017

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).

Rather than try to hook specific keys or functions, just use
post-command-hook to observe the change in buffer state. This allows
it to automatically work with things like Evil.
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