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

Wrap post and pre command hooks with frames. #56

Merged
merged 6 commits into from
Jul 5, 2020
Merged

Conversation

lastquestion
Copy link
Owner

@lastquestion lastquestion commented Jul 4, 2020

Post and pre command hooks are run from keyboard.c outside the command loop, so they don't have any command frame parents.

Advise add-hook so that we advise hooks added to pre and post command hooks so that the hooks themselves add frames before running the original hook.

When enabling, go through all existing hooks and make sure they are also advised.

Fixes #54.

  • Needs tests
  • Needs update of CHANGELOG

@lastquestion
Copy link
Owner Author

There's a challenge with lambda forms that can't be advised. If we change the form, then eq won't be true anymore, which means remove-hook needs to be advised for that to work. But people who directly read the values of lists would be in trouble.

I guess this is already true with timers, though; so I'll go ahead and do it anyway. No one actually reads the list of items in pre and post command hooks in all of emacs core elisp. Actually, no one even installs a lambda as a command hook, but I'm sure somewhere out there someone is doing it.

Post and pre command hooks are run from `keyboard.c` outside the
command loop, so they don't have any command frame parents.

Advise `add-hook` so that we advise hooks added to `pre` and `post`
command hooks so that the hooks themselves add frames before running
the original hook.

When enabling, go through all existing hooks and make sure they are
also advised.

Fixes #54.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant