4

Is there a way so that the Emacs are able to tell if the current user is undoing/redoing in the current buffer?

Here is the task I want to accomplish, I have add a hook to after-change-function, it all works out great exclusive of when I hit undo/redo this hook get called too. And this is what I want to avoid... Is there other way to get around this issue?

1
  • 2
    Welcome. Can you give an example of what you are trying to use this for? Commented Dec 2, 2018 at 12:04

1 Answer 1

6

C-hv undo-in-progress

Documentation:
Non-nil while performing an undo.
Some change-hooks test this variable to do something different.

Bearing in mind that "redoing" is really still "undoing" in Emacs, this ought to cover all cases.

1
  • 1
    @Jen-ChiehShen : please upvote and accept the answer if it resolves the problem. Thanks!
    – Dan
    Commented Dec 2, 2018 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.