diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2012-04-24 23:29:38 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2012-04-24 23:29:38 +0200 |
commit | 7a6bb0f05e349068b0a89514f1da33d6d7de30a9 (patch) | |
tree | c202b81dfaf524e71e881c15aa509c45445a64b3 /emacs.d/lisp/yasnippet/extras/imported/objc-mode/.yas-setup.el | |
parent | 66b95ab46d870f41c12c489eb21c9c82846d6112 (diff) | |
download | dotfiles-7a6bb0f05e349068b0a89514f1da33d6d7de30a9.tar.gz dotfiles-7a6bb0f05e349068b0a89514f1da33d6d7de30a9.tar.xz dotfiles-7a6bb0f05e349068b0a89514f1da33d6d7de30a9.zip |
emacs.d/lisp/yasnippet: added yasnippet
Diffstat (limited to '')
-rw-r--r-- | emacs.d/lisp/yasnippet/extras/imported/objc-mode/.yas-setup.el | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/emacs.d/lisp/yasnippet/extras/imported/objc-mode/.yas-setup.el b/emacs.d/lisp/yasnippet/extras/imported/objc-mode/.yas-setup.el new file mode 100644 index 0000000..a072e99 --- /dev/null +++ b/emacs.d/lisp/yasnippet/extras/imported/objc-mode/.yas-setup.el @@ -0,0 +1,88 @@ +(defun yas/objc-docset-query (query) + + ) +(defvar yas/objc-method-names (make-vector 1023 0)) +(defvar yas/objc-class-names (make-vector 1023 0)) + +(defvar yas/objc-languages (list)) +(defvar yas/objc-defkinds (list)) + + +(defun yas/objc-extract-super-list () + (interactive) + (setq yas/objc-method-names (make-vector 1023 0) + yas/objc-class-names (make-vector 1023 0) + yas/objc-languages (list) + yas/objc-defkinds (list)) + (with-temp-buffer + (shell-command + "/Developer/usr/bin/docsetutil dump -skip-text /Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/" + (current-buffer)) + (goto-char (point-min)) + (search-forward-regexp "API index contains .* tokens") + (while (search-forward-regexp "^\\([^/]*\\)/\\([^/]*\\)/\\([^/]*\\)/\\([^/]*\\)$" nil 'noerror) + (intern (match-string 3) yas/objc-class-names) + (intern (match-string 4) yas/objc-method-names) + (add-to-list 'yas/objc-languages (match-string 1)) + (add-to-list 'yas/objc-defkinds (match-string 2))))) + +(put (intern-soft (setq chosen (completing-read "Method: " yas/objc-method-names)) yas/objc-method-names) + 'someshit + 'someday) + +(completing-read "Class: " yas/objc-class-names) + +(get (intern-soft (setq chosen (completing-read "hey: " yas/objc-method-names)) yas/objc-method-names) + 'someshit) + +(defun yas/objc-current-method-signature () + (let ((orig-point (point)) + (start-point nil) + sig + orig-ppss + ppss) + (save-excursion + (condition-case nil + (while (not (eq (point) (point-min))) (backward-sexp)) + (error nil)) + (when (eq (preceding-char) ?\[) + (setq orig-ppss (syntax-ppss)) + (forward-sexp) + (skip-chars-forward " \t\n") + (setq ppss (syntax-ppss)) + (while (and (>= (car ppss) (car orig-ppss)) + (search-forward-regexp "[[:alpha:]]+:" nil 'noerror)) + (setq ppss (syntax-ppss)) + (when (eq (car ppss) (car orig-ppss)) + (setq sig + (concat (or sig "") (match-string-no-properties 0))))) + sig)))) + +(defun yas/objc-current-method-signature () + (let ((orig-point (point)) + (start-point nil) + sig + orig-ppss + ppss) + (save-excursion + (condition-case nil + (while (not (eq (point) (point-max))) (backward-sexp)) + (error )) + (when (eq (preceding-char) ?\[) + (setq orig-ppss (syntax-ppss)) + (forward-sexp) + (skip-chars-forward " \t\n") + (setq ppss (syntax-ppss)) + (condition-case nil + (while (and (>= (car ppss) (car orig-ppss)) + (search-forward-regexp "[[:alpha:]]+:" orig-point 'noerror)) + (setq ppss (syntax-ppss)) + (when (eq (car ppss) (car orig-ppss)) + (setq sig + (concat (or sig "") (match-string-no-properties 0)))) + (forward-sexp)) + (error nil)) + (save-excursion + (backward-word) + (concat sig (buffer-substring-no-properties (point) orig-point))) + sig)))) |