diff options
| author | Alan Mackenzie | 2018-08-27 19:49:25 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2018-08-27 19:49:25 +0000 |
| commit | 3266e69dabfb36b2c9886a5e31b87e322d01ca7f (patch) | |
| tree | 3edebccd18c5df9bb0d76ce73a0c370c67f6ca67 | |
| parent | 674f276c0ab3e9759d33f37971ef87f84a3b0683 (diff) | |
| download | emacs-3266e69dabfb36b2c9886a5e31b87e322d01ca7f.tar.gz emacs-3266e69dabfb36b2c9886a5e31b87e322d01ca7f.zip | |
c-where-wrt-brace-construct: deal with point following a struct's semicolon.
More precisely, when point is right after the terminating semicolon of a
construct like "struct foo { .... } bar;", the function must return
'at-function-end.
* lisp/progmodes/cc-cmds.el (c-where-wrt-brace-construct): Surround an
existing test for 'at-function-end with an `or' form, the other arm testing
for being after the semicolon above.
| -rw-r--r-- | lisp/progmodes/cc-cmds.el | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 478ccf18029..4f256e1008f 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el | |||
| @@ -1441,21 +1441,23 @@ No indentation or other \"electric\" behavior is performed." | |||
| 1441 | 'in-block) | 1441 | 'in-block) |
| 1442 | ((c-in-function-trailer-p) | 1442 | ((c-in-function-trailer-p) |
| 1443 | 'in-trailer) | 1443 | 'in-trailer) |
| 1444 | ((and (not least-enclosing) | 1444 | ((or (and (eq (char-before) ?\;) |
| 1445 | (consp paren-state) | 1445 | (save-excursion |
| 1446 | (consp (car paren-state)) | 1446 | (backward-char) |
| 1447 | (eq start (cdar paren-state)) | 1447 | (c-in-function-trailer-p))) |
| 1448 | (or | 1448 | (and (not least-enclosing) |
| 1449 | (save-excursion | 1449 | (consp paren-state) |
| 1450 | (c-forward-syntactic-ws) | 1450 | (consp (car paren-state)) |
| 1451 | (or (not (looking-at c-symbol-start)) | 1451 | (eq start (cdar paren-state)) |
| 1452 | (looking-at c-keywords-regexp))) | 1452 | (or |
| 1453 | (save-excursion | 1453 | (save-excursion |
| 1454 | (goto-char (caar paren-state)) | 1454 | (c-forward-syntactic-ws) |
| 1455 | (c-beginning-of-decl-1 | 1455 | (or (not (looking-at c-symbol-start)) |
| 1456 | (and least-enclosing | 1456 | (looking-at c-keywords-regexp))) |
| 1457 | (c-safe-position least-enclosing paren-state))) | 1457 | (save-excursion |
| 1458 | (not (looking-at c-defun-type-name-decl-key))))) | 1458 | (goto-char (caar paren-state)) |
| 1459 | (c-beginning-of-decl-1) | ||
| 1460 | (not (looking-at c-defun-type-name-decl-key)))))) | ||
| 1459 | 'at-function-end) | 1461 | 'at-function-end) |
| 1460 | (t | 1462 | (t |
| 1461 | ;; Find the start of the current declaration. NOTE: If we're in the | 1463 | ;; Find the start of the current declaration. NOTE: If we're in the |