diff options
| author | Alan Mackenzie | 2018-08-27 20:37:49 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2018-08-27 20:37:49 +0000 |
| commit | 66bf12b6a1777d8dd09f8ddcefe96314555d0134 (patch) | |
| tree | 31e6eb268a1876233918d67811ae482f4dd3b31c | |
| parent | 3266e69dabfb36b2c9886a5e31b87e322d01ca7f (diff) | |
| download | emacs-66bf12b6a1777d8dd09f8ddcefe96314555d0134.tar.gz emacs-66bf12b6a1777d8dd09f8ddcefe96314555d0134.zip | |
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.
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index d1eb3c3d06f..278ade0560c 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." | |||
| 12280 | ;; The '}' is unbalanced. | 12280 | ;; The '}' is unbalanced. |
| 12281 | nil | 12281 | nil |
| 12282 | (c-end-of-decl-1) | 12282 | (c-end-of-decl-1) |
| 12283 | (>= (point) indent-point)))))) | 12283 | (>= (point) indent-point)))) |
| 12284 | ;; Check that we only have one brace block here, i.e. that we | ||
| 12285 | ;; don't have something like a function with a struct | ||
| 12286 | ;; declaration as its type. | ||
| 12287 | (save-excursion | ||
| 12288 | (or (not (and state-cache (consp (car state-cache)))) | ||
| 12289 | ;; The above probably can't happen. | ||
| 12290 | (progn | ||
| 12291 | (goto-char placeholder) | ||
| 12292 | (and (c-syntactic-re-search-forward | ||
| 12293 | "{" indent-point t) | ||
| 12294 | (eq (1- (point)) (caar state-cache)))))))) | ||
| 12284 | (goto-char placeholder) | 12295 | (goto-char placeholder) |
| 12285 | (c-add-stmt-syntax 'topmost-intro-cont nil nil | 12296 | (c-add-stmt-syntax 'topmost-intro-cont nil nil |
| 12286 | containing-sexp paren-state)) | 12297 | containing-sexp paren-state)) |