Richard Stallman wrote: > if (! interval_has_some_properties_list (properties, i)) > ! if (modified) > ! { > ! if (BUFFERP (object)) > ! signal_after_change (XINT (start), XINT (end) - XINT (start), > ! XINT (end) - XINT (start)); > >I'm not confident about that code. It runs the after-change hook, but >in this case, where is the before-change hook run? > > The before-change-functions are run by modify_region called immediately before the changes are done by remove_properties. Actually, I have changed that part of the code a bit to make it more readable, see the attached patch. The general idea is: Fremove_list_of_text_properties has a for (;;) loop that loops over the parts of the interval. It updates the flag `modified' recording if changes have been done. To make things work right, we must call modify_region before calling remove_properties iff modified == 0, and we must call signal_after_change before returning iff modified != 0.