emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 99950f7: C++ Mode: attribute in class declaration f


From: Alan Mackenzie
Subject: [Emacs-diffs] master 99950f7: C++ Mode: attribute in class declaration fouls up indentation. Fix!
Date: Sat, 28 May 2016 15:19:24 +0000 (UTC)

branch: master
commit 99950f7214ee7efd1c5e6a76d5db81a5abe61694
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    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 2450a5d..b9f25ee 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 705f723..10fed6d 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]