]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/cc-cmds.el (c-defun-name): Handle objc selectors properly.
authorLeo Liu <sdl.web@gmail.com>
Fri, 20 Jul 2012 21:18:52 +0000 (05:18 +0800)
committerLeo Liu <sdl.web@gmail.com>
Fri, 20 Jul 2012 21:18:52 +0000 (05:18 +0800)
Fixes: debbugs:7879
lisp/ChangeLog
lisp/progmodes/cc-cmds.el

index bb5590b1c39b3a5350a7f8314f4279fc2eb0aa54..f305d971a0f2faa4d9d09e0d21a585686d2352fe 100644 (file)
@@ -1,5 +1,8 @@
 2012-07-20  Leo Liu  <sdl.web@gmail.com>
 
+       * 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  <monnier@iro.umontreal.ca>
index 9c8c5633b801ae31a8f5df59925a41cf30f04654..3ec7386ece086bc984b49af206ef173630f5c598 100644 (file)
@@ -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.