# HG changeset patch # User Alan Mackenzie # Date 1224275085 0 # Node ID 675bbbe81826a858c29a5c57075075358b3310a6 # Parent e6b6e66ef83f12c1bb687645f31d36120d202765 (c-defun-name): Make it work for "struct foo bar [] = { ...". diff -r e6b6e66ef83f -r 675bbbe81826 lisp/progmodes/cc-cmds.el --- a/lisp/progmodes/cc-cmds.el Fri Oct 17 20:24:02 2008 +0000 +++ b/lisp/progmodes/cc-cmds.el Fri Oct 17 20:24:45 2008 +0000 @@ -1704,17 +1704,16 @@ ;; Pick out the defun name, according to the type of defun. (cond + ;; struct, union, enum, or similar: ((and (looking-at c-type-prefix-key) (progn (c-forward-token-2 2) ; over "struct foo " - (eq (char-after) ?\{))) - ;; struct, union, enum, or similar: - (c-backward-syntactic-ws) - (setq name-end (point)) - (buffer-substring-no-properties - (progn - (c-backward-token-2 2) - (point)) - name-end)) + (or (eq (char-after) ?\{) + (looking-at c-symbol-key)))) ; "struct foo bar ..." + (save-match-data (c-forward-token-2)) + (when (eq (char-after) ?\{) + (c-backward-token-2) + (looking-at c-symbol-key)) + (match-string-no-properties 0)) ((looking-at "DEFUN\\_>") ;; DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, ...) ==> Ffile_name_directory