(defun mod-hook-text-prop (&rest args) (message "mod-hook-text-prop %S, inhibit? %S" args inhibit-modification-hooks)) (defun mod-hook-ov-prop (&rest args) (message "mod-hook-ov-prop %S, inhibit? %S" args inhibit-modification-hooks)) (defun mod-hook-change-fun (&rest args) (message "mod-hook-change-fun %S, inhibit? %S" args inhibit-modification-hooks)) (with-current-buffer (get-buffer-create "*test*") (insert (propertize "foo\n" 'modification-hooks '(mod-hook-text-prop))) (let ((ov (make-overlay (point-min) (point-max) ))) (overlay-put ov 'modification-hooks '(mod-hook-ov-prop))) (setq-local before-change-functions '(mod-hook-change-fun)) (setq-local after-change-functions '(mod-hook-change-fun)) (goto-char (point-min)) (delete-char 3) (insert "bar"))