before-change-functions
before-change-functions is a variable defined in `
C source code
'.
Its value is
nil
- This variable may be risky if used as a file-local variable.
Documentation:
List of functions to call before each text change.
Two arguments are passed to each function: the positions of
the beginning and end of the range of old text to be changed.
(For an insertion, the beginning and end are at the same place.)
No information is given about the length of the text after the change.
Buffer changes made while executing the `before-change-functions'
don't call any before-change or after-change functions.
That's because `inhibit-modification-hooks' is temporarily set non-nil.
If an unhandled error happens in running these functions,
the variable's value remains nil. That prevents the error
from happening repeatedly and making Emacs nonfunctional.