From 3ef68c2d7a3d7c314cebc27b7cbeb3016211b53e Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Tue, 17 May 2022 11:26:05 +0000 Subject: [PATCH] CC Mode: Correct a rare error in the state cache * lisp/progmodes/cc-engine.el (c-append-lower-brace-pair-to-state-cache): Do not record a position in a macro as the starting position in c-state-brace-pair-desert. Instead record the position at the beginning of that macro. --- lisp/progmodes/cc-engine.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 2a9a7a8bf5e..8794a527f88 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -3886,7 +3886,10 @@ initializing CC Mode. Currently (2020-06) these are `js-mode' and (cons (if (and ce (< bra ce) (> ce here)) ; {..} straddling HERE? bra (point-min)) - (min here from))))))))) + (progn + (goto-char (min here from)) + (c-beginning-of-macro) + (point)))))))))) (defsubst c-state-push-any-brace-pair (bra+1 macro-start-or-here) ;; If BRA+1 is nil, do nothing. Otherwise, BRA+1 is the buffer position -- 2.39.2