# HG changeset patch # User Alan Mackenzie # Date 1177004116 0 # Node ID ca93852242446374b4e27e327abe2c488d49d930 # Parent ae324f60a9cdaec4a82cb242578a0fb916a24c25 (c-in-function-trailer-p): Fix this: when a function return type contains "struct", "union", etc. c-end-of-defun goes too far forward. diff -r ae324f60a9cd -r ca9385224244 lisp/progmodes/cc-cmds.el --- a/lisp/progmodes/cc-cmds.el Thu Apr 19 17:33:34 2007 +0000 +++ b/lisp/progmodes/cc-cmds.el Thu Apr 19 17:35:16 2007 +0000 @@ -1360,10 +1360,24 @@ (and c-opt-block-decls-with-vars-key (save-excursion (c-syntactic-skip-backward "^;}" lim) - (and (eq (char-before) ?\}) - (eq (car (c-beginning-of-decl-1 lim)) 'previous) - (looking-at c-opt-block-decls-with-vars-key) - (point))))) + (let ((eo-block (point)) + bod) + (and (eq (char-before) ?\}) + (eq (car (c-beginning-of-decl-1 lim)) 'previous) + (setq bod (point)) + ;; Look for struct or union or ... If we find one, it might + ;; be the return type of a function, or the like. Exclude + ;; this case. + (c-syntactic-re-search-forward + (concat "[;=\(\[{]\\|\\(" + c-opt-block-decls-with-vars-key + "\\)") + eo-block t t t) + (match-beginning 1) ; Is there a "struct" etc., somewhere? + (not (eq (char-before) ?_)) + (c-syntactic-re-search-forward "[;=\(\[{]" eo-block t t t) + (eq (char-before) ?\{) + bod))))) (defun c-where-wrt-brace-construct () ;; Determine where we are with respect to functions (or other brace