[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 66bf12b: CC Mode: Fix syntactic context of BOD some
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] master 66bf12b: CC Mode: Fix syntactic context of BOD sometimes being 'topmost-intro-cont |
Date: |
Mon, 27 Aug 2018 16:39:26 -0400 (EDT) |
branch: master
commit 66bf12b6a1777d8dd09f8ddcefe96314555d0134
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>
CC Mode: Fix syntactic context of BOD sometimes being 'topmost-intro-cont
This happened when the type of the previous function was a struct, etc.,
declaration.
* lisp/progmodes/cc-mode (c-guess-basic-syntax CASE 5N): Check here (for
'topmost-intro-cont) that the first opening brace after BOD is the opening
brace preceding the starting point.
---
lisp/progmodes/cc-engine.el | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index d1eb3c3..278ade0 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -12280,7 +12280,18 @@ comment at the start of cc-engine.el for more info."
;; The '}' is unbalanced.
nil
(c-end-of-decl-1)
- (>= (point) indent-point))))))
+ (>= (point) indent-point))))
+ ;; Check that we only have one brace block here, i.e. that we
+ ;; don't have something like a function with a struct
+ ;; declaration as its type.
+ (save-excursion
+ (or (not (and state-cache (consp (car state-cache))))
+ ;; The above probably can't happen.
+ (progn
+ (goto-char placeholder)
+ (and (c-syntactic-re-search-forward
+ "{" indent-point t)
+ (eq (1- (point)) (caar state-cache))))))))
(goto-char placeholder)
(c-add-stmt-syntax 'topmost-intro-cont nil nil
containing-sexp paren-state))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 66bf12b: CC Mode: Fix syntactic context of BOD sometimes being 'topmost-intro-cont,
Alan Mackenzie <=