diff --git a/lisp/emacs-lisp/track-changes.el b/lisp/emacs-lisp/track-changes.el index 92d14959763..1d5c5e9917a 100644 --- a/lisp/emacs-lisp/track-changes.el +++ b/lisp/emacs-lisp/track-changes.el @@ -555,16 +555,16 @@ track-changes--before (defun track-changes--after (beg end len) (cl-assert track-changes--state) - (and (eq track-changes--before-clean 'unset) - (not track-changes--before-no) - ;; This can be a sign that a `before-change-functions' went missing, - ;; or that we called `track-changes--clean-state' between - ;; a `before-change-functions' and `after-change-functions'. - (track-changes--before beg end)) - (setq track-changes--before-clean nil) (let ((offset (- (- end beg) len))) - (cl-incf track-changes--before-end offset) (cl-incf track-changes--buffer-size offset) + (if (and (eq track-changes--before-clean 'unset) + (not track-changes--before-no)) + ;; This can be a sign that a `before-change-functions' went missing, + ;; or that we called `track-changes--clean-state' between + ;; a `before-change-functions' and `after-change-functions'. + (track-changes--before beg end) + (cl-incf track-changes--before-end offset)) + (setq track-changes--before-clean nil) (if (not (or track-changes--before-no (save-restriction (widen)