aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/cc-mode.el
diff options
context:
space:
mode:
authorAlan Mackenzie2020-03-04 21:17:04 +0000
committerAlan Mackenzie2020-03-04 21:17:04 +0000
commita3c2d186eb514b505e61c2a89a1df886dbfcb06b (patch)
tree6ac57f827e82755c48cd6f30875e9e27d6d78010 /lisp/progmodes/cc-mode.el
parenta1abf73c7642339c111646afed1d5d05ecada9c7 (diff)
downloademacs-a3c2d186eb514b505e61c2a89a1df886dbfcb06b.tar.gz
emacs-a3c2d186eb514b505e61c2a89a1df886dbfcb06b.zip
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.
Diffstat (limited to 'lisp/progmodes/cc-mode.el')
-rw-r--r--lisp/progmodes/cc-mode.el13
1 files changed, 6 insertions, 7 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 9f95a9ce48b..fd7750b0d82 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....\".")
1992 1992
1993 ;; Note: c-just-done-before-change is nil, t, or 'whole-buffer. 1993 ;; Note: c-just-done-before-change is nil, t, or 'whole-buffer.
1994 (unless (c-called-from-text-property-change-p) 1994 (unless (c-called-from-text-property-change-p)
1995 (save-restriction 1995 (unless (eq c-just-done-before-change t)
1996 (widen) 1996 (save-restriction
1997 (unless c-just-done-before-change 1997 (widen)
1998 (c-before-change (point-min) (point-max))) 1998 (when (null c-just-done-before-change)
1999 (unless (eq c-just-done-before-change t) 1999 (c-before-change (point-min) (point-max)))
2000 (setq beg (point-min) 2000 (setq beg (point-min)
2001 end (point-max) 2001 end (point-max)
2002 old-len (- end beg) 2002 old-len (- end beg)
2003 c-new-BEG (point-min) 2003 c-new-BEG (point-min)
2004 c-new-END (point-max))) 2004 c-new-END (point-max)))))
2005 (setq c-just-done-before-change nil)))
2006 2005
2007 ;; (c-new-BEG c-new-END) will be the region to fontify. It may become 2006 ;; (c-new-BEG c-new-END) will be the region to fontify. It may become
2008 ;; larger than (beg end). 2007 ;; larger than (beg end).