emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-27 a3c2d18: CC Mode: Fix the handling of two adjacent after-change


From: Alan Mackenzie
Subject: emacs-27 a3c2d18: CC Mode: Fix the handling of two adjacent after-change-functionses.
Date: Wed, 4 Mar 2020 16:19:28 -0500 (EST)

branch: emacs-27
commit a3c2d186eb514b505e61c2a89a1df886dbfcb06b
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    CC Mode: Fix the handling of two adjacent after-change-functionses.
    
    The bug involved failing to set c-new-END correctly, which lead to an
    args-out-of-range error when after-change-functions was invoked twice 
without
    an intervening invocation of before-change-functions.
    
    * lisp/progmodes/cc-mode.el (c-after-change): Correct a coding error in the
    handling of c-just-done-before-change.
---
 lisp/progmodes/cc-mode.el | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 9f95a9c..fd7750b 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1992,17 +1992,16 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
 
   ;; Note: c-just-done-before-change is nil, t, or 'whole-buffer.
   (unless (c-called-from-text-property-change-p)
-    (save-restriction
-      (widen)
-      (unless c-just-done-before-change
-       (c-before-change (point-min) (point-max)))
-      (unless (eq c-just-done-before-change t)
+    (unless (eq c-just-done-before-change t)
+      (save-restriction
+       (widen)
+       (when (null c-just-done-before-change)
+         (c-before-change (point-min) (point-max)))
        (setq beg (point-min)
              end (point-max)
              old-len (- end beg)
              c-new-BEG (point-min)
-             c-new-END (point-max)))
-      (setq c-just-done-before-change nil)))
+             c-new-END (point-max)))))
 
   ;; (c-new-BEG c-new-END) will be the region to fontify.  It may become
   ;; larger than (beg end).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]