From: Leo Liu Date: Fri, 20 Jul 2012 21:18:52 +0000 (+0800) Subject: * lisp/progmodes/cc-cmds.el (c-defun-name): Handle objc selectors properly. X-Git-Tag: emacs-24.2~46 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3646bcd6b8d321bbcf08bf8204ad92bdd3f1f0da;p=emacs.git * lisp/progmodes/cc-cmds.el (c-defun-name): Handle objc selectors properly. Fixes: debbugs:7879 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bb5590b1c39..f305d971a0f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2012-07-20 Leo Liu + * progmodes/cc-cmds.el (c-defun-name): Handle objc selectors properly. + (Bug#7879) + * progmodes/cc-langs.el (c-symbol-start): Include char _ (bug#11986). 2012-07-18 Stefan Monnier diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 9c8c5633b80..3ec7386ece0 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -1826,14 +1826,16 @@ with a brace block." ;; DEFFLAGSET(syslog_opt_flags,LOG_PID ...) ==> syslog_opt_flags (match-string-no-properties 1)) - ;; Objective-C method starting with + or -. - ((and (derived-mode-p 'objc-mode) - (looking-at "[-+]\s*(")) - (when (c-syntactic-re-search-forward ")\s*" nil t) - (c-forward-token-2) - (setq name-end (point)) - (c-backward-token-2) - (buffer-substring-no-properties (point) name-end))) + ;; Objc selectors. + ((assq 'objc-method-intro (c-guess-basic-syntax)) + (let ((bound (save-excursion (c-end-of-statement) (point))) + (kw-re (concat "\\(?:" c-symbol-key "\\)?:")) + (stretches)) + (when (c-syntactic-re-search-forward c-symbol-key bound t t t) + (push (match-string 0) stretches) + (while (c-syntactic-re-search-forward kw-re bound t t t) + (push (match-string 0) stretches))) + (apply 'concat (nreverse stretches)))) (t ;; Normal function or initializer.