summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/track-changes.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2024-10-17 11:39:19 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2024-10-17 11:39:19 -0400
commit90c6880a922029ba6e57adb2afe00a6fa57ef7fe (patch)
tree963171929e400321970854d9fd9aa129523e6da7 /lisp/emacs-lisp/track-changes.el
parentd3c94102266fa1fe167f699a92b9064c02b63d4f (diff)
downloademacs-90c6880a922029ba6e57adb2afe00a6fa57ef7fe.tar.gz
emacs-90c6880a922029ba6e57adb2afe00a6fa57ef7fe.tar.bz2
emacs-90c6880a922029ba6e57adb2afe00a6fa57ef7fe.zip
(track-changes--after): Fix problem found in bug#73041
When calling `track-changes--before` (e.g. because of a missing b-f-c or for some other reason), it sets `track-changes--before-end` to the right value so we shouldn't increment it right after. Also, we should update `track-changes--buffer-size` before calling `track-changes--before` so it doesn't risk signaling a spurious inconsistency. * lisp/emacs-lisp/track-changes.el (track-changes--after): Update `track-changes--buffer-size` earlier, and don't increment `track-changes--before-end` when we call `track-changes--before`.
Diffstat (limited to 'lisp/emacs-lisp/track-changes.el')
-rw-r--r--lisp/emacs-lisp/track-changes.el16
1 files changed, 8 insertions, 8 deletions
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 @@ Details logged to `track-changes--error-log'")
(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)