]> code.delx.au - gnu-emacs-elpa/blob - extras/imported/objc-mode/.yas-setup.el
minor tweaks to the rails-related bundles import strategy, which are quite usable...
[gnu-emacs-elpa] / extras / imported / objc-mode / .yas-setup.el
1 (defun yas/objc-docset-query (query)
2
3 )
4 (defvar yas/objc-method-names (make-vector 1023 0))
5 (defvar yas/objc-class-names (make-vector 1023 0))
6
7 (defvar yas/objc-languages (list))
8 (defvar yas/objc-defkinds (list))
9
10
11 (defun yas/objc-extract-super-list ()
12 (interactive)
13 (setq yas/objc-method-names (make-vector 1023 0)
14 yas/objc-class-names (make-vector 1023 0)
15 yas/objc-languages (list)
16 yas/objc-defkinds (list))
17 (with-temp-buffer
18 (shell-command
19 "/Developer/usr/bin/docsetutil dump -skip-text /Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/"
20 (current-buffer))
21 (goto-char (point-min))
22 (search-forward-regexp "API index contains .* tokens")
23 (while (search-forward-regexp "^\\([^/]*\\)/\\([^/]*\\)/\\([^/]*\\)/\\([^/]*\\)$" nil 'noerror)
24 (intern (match-string 3) yas/objc-class-names)
25 (intern (match-string 4) yas/objc-method-names)
26 (add-to-list 'yas/objc-languages (match-string 1))
27 (add-to-list 'yas/objc-defkinds (match-string 2)))))
28
29 ;; (put (intern-soft (setq chosen (completing-read "Method: " yas/objc-method-names)) yas/objc-method-names)
30 ;; 'someshit
31 ;; 'someday)
32
33 ;; (completing-read "Class: " yas/objc-class-names)
34
35 ;; (get (intern-soft (setq chosen (completing-read "hey: " yas/objc-method-names)) yas/objc-method-names)
36 ;; 'someshit)
37
38 (defun yas/objc-current-method-signature ()
39 (let ((orig-point (point))
40 (start-point nil)
41 sig
42 orig-ppss
43 ppss)
44 (save-excursion
45 (condition-case nil
46 (while (not (eq (point) (point-min))) (backward-sexp))
47 (error nil))
48 (when (eq (preceding-char) ?\[)
49 (setq orig-ppss (syntax-ppss))
50 (forward-sexp)
51 (skip-chars-forward " \t\n")
52 (setq ppss (syntax-ppss))
53 (while (and (>= (car ppss) (car orig-ppss))
54 (search-forward-regexp "[[:alpha:]]+:" nil 'noerror))
55 (setq ppss (syntax-ppss))
56 (when (eq (car ppss) (car orig-ppss))
57 (setq sig
58 (concat (or sig "") (match-string-no-properties 0)))))
59 sig))))
60
61 (defun yas/objc-current-method-signature ()
62 (let ((orig-point (point))
63 (start-point nil)
64 sig
65 orig-ppss
66 ppss)
67 (save-excursion
68 (condition-case nil
69 (while (not (eq (point) (point-max))) (backward-sexp))
70 (error ))
71 (when (eq (preceding-char) ?\[)
72 (setq orig-ppss (syntax-ppss))
73 (forward-sexp)
74 (skip-chars-forward " \t\n")
75 (setq ppss (syntax-ppss))
76 (condition-case nil
77 (while (and (>= (car ppss) (car orig-ppss))
78 (search-forward-regexp "[[:alpha:]]+:" orig-point 'noerror))
79 (setq ppss (syntax-ppss))
80 (when (eq (car ppss) (car orig-ppss))
81 (setq sig
82 (concat (or sig "") (match-string-no-properties 0))))
83 (forward-sexp))
84 (error nil))
85 (save-excursion
86 (backward-word)
87 (concat sig (buffer-substring-no-properties (point) orig-point)))
88 sig))))