comparison lisp/progmodes/cc-cmds.el @ 77317:ca9385224244

(c-in-function-trailer-p): Fix this: when a function return type contains "struct", "union", etc. c-end-of-defun goes too far forward.
author Alan Mackenzie <acm@muc.de>
date Thu, 19 Apr 2007 17:35:16 +0000
parents 1f5115cdbed5
children 93216aab76bf
comparison
equal deleted inserted replaced
77316:ae324f60a9cd 77317:ca9385224244
1358 ;; 1358 ;;
1359 ;; This function might do hidden buffer changes. 1359 ;; This function might do hidden buffer changes.
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
1370 ;; constructs, included in the term "function" in the rest of this comment). 1384 ;; constructs, included in the term "function" in the rest of this comment).
1371 ;; Point is assumed to be outside any macro or literal. 1385 ;; Point is assumed to be outside any macro or literal.