tweaking some basic objc snippets

This commit is contained in:
capitaomorte
2010-03-14 19:58:27 +00:00
parent a090443417
commit f1ce4866b6
9 changed files with 46 additions and 34 deletions

View File

@@ -1,4 +1,24 @@
;;; conditions
;;; constants
(defvar yas/objc-void-regexp "\\(void\\|IBAction\\)")
;;; helper stuff
(defun yas/objc-guess-instance-name (text)
(if (string-match "NS\\(\\([AEIOQUY]\\)?[^ *]*\\)" text)
(if (match-beginning 2)
(concat "an" (capitalize (match-string-no-properties 1 text)))
(concat "a" (capitalize (match-string-no-properties 1 text))))
"arg"))
(defun yas/objc-guess-member-name (text)
"Turns FOOBARBaz to baz"
(let ((case-fold-search nil))
(if (string-match "[A-Z]+\\([A-Z]\\)\\(.*\\)" text)
(concat (downcase (match-string-no-properties 1 text))
(match-string-no-properties 2 text))
text)))
;;; cached conditions
(yas/define-condition-cache
yas/objc-interface-p
"Non-nil if point inside an objc @interface declaration."
@@ -11,10 +31,10 @@
(yas/define-condition-cache
yas/objc-method-body-p
"Non-nil if point inside an objc @implementation declaration."
"Non-nil if point inside an objc method definition."
(yas/objc-in-c-block-like 'objc-method-intro))
;;; helpers for cached conditions
(defun yas/objc-in-c-block-like (symbol-or-regexp)
(let ((original-point (point))
(start-point nil))