From b3a5ad14c1f047786fb71ff6f181b529ffc6ed9e Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Tue, 26 Oct 2021 20:13:18 +0000 Subject: [PATCH] CC Mode: minor amendments more accurately to handle virtual semicolons, etc. * lisp/progmodes/cc-engine.el (c-laomib-loop): Check for a virtual semicolon as well as a ;. (c-guess-basic-syntax): CASE 5D - Use c-crosses-statement-barrier-p to check whether we've gone back past a virtual semicolon. --- lisp/progmodes/cc-engine.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 75487bdb6b6..a4568bd4efc 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -12102,7 +12102,10 @@ comment at the start of cc-engine.el for more info." (and (c-major-mode-is 'pike-mode) c-decl-block-key))) (while (eq braceassignp 'dontknow) - (cond ((eq (char-after) ?\;) + (cond ((or (eq (char-after) ?\;) + (save-excursion + (progn (c-backward-syntactic-ws) + (c-at-vsemi-p)))) (setq braceassignp nil)) ((and class-key (looking-at class-key)) @@ -14026,7 +14029,8 @@ comment at the start of cc-engine.el for more info." ;; clause - we assume only C++ needs it. (c-syntactic-skip-backward "^;,=" lim t)) (setq placeholder (point)) - (memq (char-before) '(?, ?= ?<))) + (and (memq (char-before) '(?, ?= ?<)) + (not (c-crosses-statement-barrier-p (point) indent-point)))) (cond ;; CASE 5D.6: Something like C++11's "using foo = " -- 2.39.2