diff options
| author | Alan Mackenzie | 2007-04-19 17:35:16 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2007-04-19 17:35:16 +0000 |
| commit | 8007b73c143db55e1a40cb00bd9a9507bb154ad8 (patch) | |
| tree | 83ab6e8d18b4003ef7c9ec49ef901a40535449c0 | |
| parent | 0f13b47681f2ad7d92ec7348ebc538c340c22159 (diff) | |
| download | emacs-8007b73c143db55e1a40cb00bd9a9507bb154ad8.tar.gz emacs-8007b73c143db55e1a40cb00bd9a9507bb154ad8.zip | |
(c-in-function-trailer-p): Fix this: when a function return type contains
"struct", "union", etc. c-end-of-defun goes too far forward.
| -rw-r--r-- | lisp/progmodes/cc-cmds.el | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 2bda3a174cf..9ef4aaace72 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el | |||
| @@ -1360,10 +1360,24 @@ No indentation or other \"electric\" behavior is performed." | |||
| 1360 | (and c-opt-block-decls-with-vars-key | 1360 | (and c-opt-block-decls-with-vars-key |
| 1361 | (save-excursion | 1361 | (save-excursion |
| 1362 | (c-syntactic-skip-backward "^;}" lim) | 1362 | (c-syntactic-skip-backward "^;}" lim) |
| 1363 | (and (eq (char-before) ?\}) | 1363 | (let ((eo-block (point)) |
| 1364 | (eq (car (c-beginning-of-decl-1 lim)) 'previous) | 1364 | bod) |
| 1365 | (looking-at c-opt-block-decls-with-vars-key) | 1365 | (and (eq (char-before) ?\}) |
| 1366 | (point))))) | 1366 | (eq (car (c-beginning-of-decl-1 lim)) 'previous) |
| 1367 | (setq bod (point)) | ||
| 1368 | ;; Look for struct or union or ... If we find one, it might | ||
| 1369 | ;; be the return type of a function, or the like. Exclude | ||
| 1370 | ;; this case. | ||
| 1371 | (c-syntactic-re-search-forward | ||
| 1372 | (concat "[;=\(\[{]\\|\\(" | ||
| 1373 | c-opt-block-decls-with-vars-key | ||
| 1374 | "\\)") | ||
| 1375 | eo-block t t t) | ||
| 1376 | (match-beginning 1) ; Is there a "struct" etc., somewhere? | ||
| 1377 | (not (eq (char-before) ?_)) | ||
| 1378 | (c-syntactic-re-search-forward "[;=\(\[{]" eo-block t t t) | ||
| 1379 | (eq (char-before) ?\{) | ||
| 1380 | bod))))) | ||
| 1367 | 1381 | ||
| 1368 | (defun c-where-wrt-brace-construct () | 1382 | (defun c-where-wrt-brace-construct () |
| 1369 | ;; Determine where we are with respect to functions (or other brace | 1383 | ;; Determine where we are with respect to functions (or other brace |