From fe1a523fd9cecbaabc3215b030848f25f15a9c20 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Sat, 21 Jul 2012 03:59:49 +0800 Subject: [PATCH] Backport: Recognize Objective-C methods also in c-defun-name Fixes: debbugs:7879 --- lisp/ChangeLog | 5 +++++ lisp/progmodes/cc-cmds.el | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 87df9b17349..bb5590b1c39 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -11,6 +11,11 @@ * progmodes/cperl-mode.el (cperl-unwind-to-safe): Don't inf-loop at end of narrowed buffer (bug#11966). +2012-07-14 Jan Djärv + + * progmodes/cc-cmds.el (c-defun-name): Recognize Objective-C methods + also (Bug#7879). + 2012-07-09 Stefan Monnier * progmodes/sh-script.el (sh-syntax-propertize-function): Fix last diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 9cf20ccb516..9c8c5633b80 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -1826,6 +1826,15 @@ 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))) + (t ;; Normal function or initializer. (when (c-syntactic-re-search-forward "[{(]" nil t) -- 2.39.5