From 99950f7214ee7efd1c5e6a76d5db81a5abe61694 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sat, 28 May 2016 15:17:28 +0000 Subject: [PATCH] C++ Mode: attribute in class declaration fouls up indentation. Fix! * lisp/progmodes/cc-engine.el (c-looking-at-decl-block): Add code to skip back over noise clauses and attribute clauses. * lisp/progmodes/cc-langs.el (c-paren-nontype-key): New language variable. --- lisp/progmodes/cc-engine.el | 16 ++++++++++++++++ lisp/progmodes/cc-langs.el | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 2450a5db8b9..b9f25eeaee4 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -8899,6 +8899,22 @@ comment at the start of cc-engine.el for more info." (c-syntactic-skip-backward c-block-prefix-charset limit t) (eq (char-before) ?>)))))) + ;; Skip back over noise clauses. + (while (and + c-opt-cpp-prefix + (eq (char-before) ?\)) + (let ((after-paren (point))) + (if (and (c-go-list-backward) + (progn (c-backward-syntactic-ws) + (c-simple-skip-symbol-backward)) + (or (looking-at c-paren-nontype-key) + (looking-at c-noise-macro-with-parens-name-re))) + (progn + (c-syntactic-skip-backward c-block-prefix-charset limit t) + t) + (goto-char after-paren) + nil)))) + ;; Note: Can't get bogus hits inside template arglists below since they ;; have gotten paren syntax above. (when (and diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 705f723d55d..10fed6d77fc 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -2264,6 +2264,10 @@ contain type identifiers." ;; MSVC extension. "__declspec")) +(c-lang-defconst c-paren-nontype-key + t (c-make-keywords-re t (c-lang-const c-paren-nontype-kwds))) +(c-lang-defvar c-paren-nontype-key (c-lang-const c-paren-nontype-key)) + (c-lang-defconst c-paren-type-kwds "Keywords that may be followed by a parenthesis expression containing type identifiers separated by arbitrary tokens." -- 2.39.2