From 9078f34e84178553cd59bc03ac1b58cb56038436 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie <acm@muc.de> Date: Fri, 25 Jan 2019 16:14:00 +0000 Subject: [PATCH] Fix a loop in c-fl-decl-start. This fixes bug #34186. * lisp/progmodes/cc-mode.el (c-fl-decl-start) In the pair of operations c-syntactic-skip-backward and c-forward-syntactic-ws, ensure the latter doesn't come back to the position before the former, and break out of the enclosing loop if it does. --- lisp/progmodes/cc-mode.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 8cbb4e86123..5283cfea6eb 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1487,6 +1487,7 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") ;; lock context (etc.) fontification. (goto-char pos) (let ((lit-start (c-literal-start)) + old-pos (new-pos pos) capture-opener bod-lim bo-decl) @@ -1509,12 +1510,14 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") (while ;; Go to a less nested declaration each time round this loop. (and + (setq old-pos (point)) (c-syntactic-skip-backward "^;{}" bod-lim t) (> (point) bod-lim) (progn (c-forward-syntactic-ws) ;; Have we got stuck in a comment at EOB? (not (and (eobp) (c-literal-start)))) + (< (point) old-pos) (progn (setq bo-decl (point)) (or (not (looking-at c-protection-key)) (c-forward-keyword-clause 1))) -- 2.39.5