rcodetools 0.8.3.0 → 0.8.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.emacs +5 -1
- data/anything-rcodetools.el +62 -57
- data/bin/rct-complete +4 -1
- data/bin/rct-doc +1 -1
- data/bin/rct-meth-args +1 -1
- data/bin/xmpfilter +1 -1
- data/lib/rcodetools/completion.rb +25 -0
- data/lib/rcodetools/xmpfilter.rb +1 -1
- data/rcodetools.el +4 -1
- data/rcodetools.elc +0 -0
- metadata +17 -5
data/README.emacs
CHANGED
@@ -26,8 +26,12 @@ If you use anything.el copy <tt>anything-rcodetools.el</tt> too.
|
|
26
26
|
Then require it.
|
27
27
|
(require 'anything-rcodetools)
|
28
28
|
RI document on each candidate during completion.
|
29
|
-
I think anything-rcodetools is more convenient than icicles-rcodetools.
|
30
29
|
|
30
|
+
anything-show-completion.el shows selection (mehod) in buffer for completion.
|
31
|
+
It is available in:
|
32
|
+
http://www.emacswiki.org/cgi-bin/wiki/download/anything-show-completion.el
|
33
|
+
|
34
|
+
I think anything-rcodetools is more convenient than icicles-rcodetools.
|
31
35
|
I'm addicted to anything!
|
32
36
|
http://www.emacswiki.org/cgi-bin/wiki/Anything
|
33
37
|
|
data/anything-rcodetools.el
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
;;; anything-rcodetools.el --- accurate Ruby method completion with anything
|
2
|
-
;; $Id: anything-rcodetools.el,v 1.
|
2
|
+
;; $Id: anything-rcodetools.el,v 1.12 2009/04/18 10:12:02 rubikitch Exp $
|
3
3
|
|
4
4
|
;;; Copyright (c) 2007 rubikitch
|
5
5
|
|
@@ -20,9 +20,39 @@
|
|
20
20
|
;; ;; See docs
|
21
21
|
;; (define-key anything-map "\C-z" 'anything-execute-persistent-action)
|
22
22
|
|
23
|
+
;;; Commands:
|
24
|
+
;;
|
25
|
+
;; Below are complete command list:
|
26
|
+
;;
|
27
|
+
;;
|
28
|
+
;;; Customizable Options:
|
29
|
+
;;
|
30
|
+
;; Below are customizable option list:
|
31
|
+
;;
|
32
|
+
|
23
33
|
;;; History:
|
24
34
|
|
25
35
|
;; $Log: anything-rcodetools.el,v $
|
36
|
+
;; Revision 1.12 2009/04/18 10:12:02 rubikitch
|
37
|
+
;; Adjust to change of `use-anything-show-completion'
|
38
|
+
;;
|
39
|
+
;; Revision 1.11 2009/04/17 20:21:47 rubikitch
|
40
|
+
;; * require anything
|
41
|
+
;; * require anything-show-completion.el if available
|
42
|
+
;;
|
43
|
+
;; Revision 1.10 2009/04/17 20:11:03 rubikitch
|
44
|
+
;; removed old code
|
45
|
+
;;
|
46
|
+
;; Revision 1.9 2009/04/17 20:07:52 rubikitch
|
47
|
+
;; * use --completion-emacs-anything option
|
48
|
+
;; * New implementation of `anything-c-source-complete-ruby-all'
|
49
|
+
;;
|
50
|
+
;; Revision 1.8 2009/04/15 10:25:25 rubikitch
|
51
|
+
;; Set `anything-execute-action-at-once-if-one' t
|
52
|
+
;;
|
53
|
+
;; Revision 1.7 2009/04/15 10:24:23 rubikitch
|
54
|
+
;; regexp bug fix
|
55
|
+
;;
|
26
56
|
;; Revision 1.6 2008/01/14 17:59:34 rubikitch
|
27
57
|
;; * uniform format (anything-c-source-complete-ruby, anything-c-source-complete-ruby-all)
|
28
58
|
;; * rename command: anything-c-ri -> anything-rct-ri
|
@@ -46,49 +76,21 @@
|
|
46
76
|
|
47
77
|
;;; Code:
|
48
78
|
|
79
|
+
(require 'anything)
|
49
80
|
(require 'rcodetools)
|
81
|
+
(when (require 'anything-show-completion nil t)
|
82
|
+
(use-anything-show-completion 'rct-complete-symbol--anything
|
83
|
+
'(length pattern)))
|
50
84
|
|
51
|
-
|
52
|
-
(
|
53
|
-
|
54
|
-
|
55
|
-
(interactive)
|
56
|
-
(save-selected-window
|
57
|
-
(select-window (get-buffer-window anything-buffer))
|
58
|
-
(select-window (setq minibuffer-scroll-window
|
59
|
-
(if (one-window-p t) (split-window) (next-window (selected-window) 1))))
|
60
|
-
(let* ((anything-window (get-buffer-window anything-buffer))
|
61
|
-
(selection (if anything-saved-sources
|
62
|
-
;; the action list is shown
|
63
|
-
anything-saved-selection
|
64
|
-
(anything-get-selection)))
|
65
|
-
(default-action (anything-get-action))
|
66
|
-
(action (assoc-default 'persistent-action (anything-get-current-source))))
|
67
|
-
(setq action (or action default-action))
|
68
|
-
(if (and (listp action)
|
69
|
-
(not (functionp action))) ; lambda
|
70
|
-
;; select the default action
|
71
|
-
(setq action (cdar action)))
|
72
|
-
(set-window-dedicated-p anything-window t)
|
73
|
-
(unwind-protect
|
74
|
-
(and action selection (funcall action selection))
|
75
|
-
(set-window-dedicated-p anything-window nil))))))
|
76
|
-
|
77
|
-
(unless (boundp 'anything-current-buffer)
|
78
|
-
(defvar anything-current-buffer nil)
|
79
|
-
(defadvice anything (before get-current-buffer activate)
|
80
|
-
(setq anything-current-buffer (current-buffer))))
|
81
|
-
|
82
|
-
;;;; Main code
|
83
|
-
(defun anything-rct-ri (pair)
|
84
|
-
(ri (substring (cadr (split-string pair "\t")) 1 -1)))
|
85
|
-
|
86
|
-
(defun anything-rct-complete (pair)
|
85
|
+
(defun anything-rct-ri (meth)
|
86
|
+
(ri (get-text-property 0 'desc meth)))
|
87
|
+
|
88
|
+
(defun anything-rct-complete (meth)
|
87
89
|
(save-excursion
|
88
90
|
(set-buffer anything-current-buffer)
|
89
91
|
(search-backward pattern)
|
90
92
|
(delete-char (length pattern)))
|
91
|
-
(insert
|
93
|
+
(insert meth))
|
92
94
|
|
93
95
|
(setq rct-complete-symbol-function 'rct-complete-symbol--anything)
|
94
96
|
(defvar anything-c-source-complete-ruby
|
@@ -97,7 +99,7 @@
|
|
97
99
|
(init
|
98
100
|
. (lambda ()
|
99
101
|
(condition-case x
|
100
|
-
(rct-exec-and-eval rct-complete-command-name "--completion-emacs-
|
102
|
+
(rct-exec-and-eval rct-complete-command-name "--completion-emacs-anything")
|
101
103
|
((error) (setq rct-method-completion-table nil)))))
|
102
104
|
(action
|
103
105
|
("Completion" . anything-rct-complete)
|
@@ -106,34 +108,37 @@
|
|
106
108
|
(persistent-action . anything-rct-ri)))
|
107
109
|
|
108
110
|
(defvar rct-get-all-methods-command "PAGER=cat fri -l")
|
109
|
-
(defun rct-get-all-methods ()
|
110
|
-
(interactive)
|
111
|
-
(setq rct-all-methods
|
112
|
-
(mapcar (lambda (fullname)
|
113
|
-
(replace-regexp-in-string "^.+[:#.]\\([^:#.]+\\)$"
|
114
|
-
"\\1\t[\\&]" fullname))
|
115
|
-
(split-string (shell-command-to-string rct-get-all-methods-command) "\n"))))
|
116
|
-
|
117
|
-
(defvar rct-all-methods (rct-get-all-methods))
|
118
111
|
(defvar anything-c-source-complete-ruby-all
|
119
112
|
'((name . "Ruby Method Completion (ALL)")
|
120
|
-
(
|
113
|
+
(init
|
121
114
|
. (lambda ()
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
115
|
+
(unless (anything-candidate-buffer)
|
116
|
+
(with-current-buffer (anything-candidate-buffer 'global)
|
117
|
+
(call-process-shell-command rct-get-all-methods-command nil t)
|
118
|
+
(goto-char 1)
|
119
|
+
(while (re-search-forward "^.+[:#.]\\([^:#.]+\\)$" nil t)
|
120
|
+
(replace-match "\\1\t[\\&]"))))))
|
121
|
+
(candidates-in-buffer
|
122
|
+
. (lambda ()
|
123
|
+
(let ((anything-pattern (format "^%s.*%s" (regexp-quote pattern) anything-pattern)))
|
124
|
+
(anything-candidates-in-buffer))))
|
125
|
+
(display-to-real
|
126
|
+
. (lambda (line)
|
127
|
+
(if (string-match "\t\\[\\(.+\\)\\]$" line)
|
128
|
+
(propertize (substring line 0 (match-beginning 0))
|
129
|
+
'desc (match-string 1 line))
|
130
|
+
line)))
|
128
131
|
(action
|
129
132
|
("Completion" . anything-rct-complete)
|
130
133
|
("RI" . anything-rct-ri))
|
131
134
|
(persistent-action . anything-rct-ri)))
|
132
135
|
|
136
|
+
|
133
137
|
(defun rct-complete-symbol--anything ()
|
134
138
|
(interactive)
|
135
|
-
(let ((anything-
|
136
|
-
(anything
|
139
|
+
(let ((anything-execute-action-at-once-if-one t))
|
140
|
+
(anything '(anything-c-source-complete-ruby
|
141
|
+
anything-c-source-complete-ruby-all))))
|
137
142
|
|
138
143
|
(provide 'anything-rcodetools)
|
139
144
|
|
data/bin/rct-complete
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#! /
|
1
|
+
#! /usr/local/bin/ruby18
|
2
2
|
require 'rcodetools/xmpfilter'
|
3
3
|
require 'rcodetools/completion'
|
4
4
|
require 'rcodetools/options'
|
@@ -22,6 +22,9 @@ opts = OptionParser.new do |opts|
|
|
22
22
|
opts.on("--completion-emacs-icicles", "Generate completion code for Emacs/Icicles.") do
|
23
23
|
klass = XMPCompletionEmacsIciclesFilter
|
24
24
|
end
|
25
|
+
opts.on("--completion-emacs-anything", "Generate completion code for Emacs/Anything.") do
|
26
|
+
klass = XMPCompletionEmacsAnythingFilter
|
27
|
+
end
|
25
28
|
opts.on("--completion-class-info", "List completion candidates with class.") do
|
26
29
|
klass = XMPCompletionClassInfoFilter
|
27
30
|
end
|
data/bin/rct-doc
CHANGED
data/bin/rct-meth-args
CHANGED
data/bin/xmpfilter
CHANGED
@@ -378,4 +378,29 @@ class XMPCompletionEmacsIciclesFilter < XMPCompletionEmacsFilter
|
|
378
378
|
end
|
379
379
|
end
|
380
380
|
|
381
|
+
class XMPCompletionEmacsAnythingFilter < XMPCompletionEmacsFilter
|
382
|
+
@candidates_with_description_flag = true
|
383
|
+
|
384
|
+
def completion_code(code, lineno, column=nil)
|
385
|
+
elisp = "(progn\n"
|
386
|
+
table = "(setq rct-method-completion-table `("
|
387
|
+
|
388
|
+
begin
|
389
|
+
klass, cands = candidates_with_class(code, lineno, column)
|
390
|
+
cands.sort.each do |minfo|
|
391
|
+
meth, description = split_method_info(minfo)
|
392
|
+
table << format('("%s\\t[%s]" . ,(propertize "%s" \'desc "%s")) ',
|
393
|
+
meth, description, meth, description)
|
394
|
+
end
|
395
|
+
table << "))\n"
|
396
|
+
rescue Exception => err
|
397
|
+
return error_code(err)
|
398
|
+
end
|
399
|
+
elisp << table
|
400
|
+
elisp << %Q[(setq pattern "#{prefix}")\n]
|
401
|
+
elisp << %Q[(setq klass "#{klass}")\n]
|
402
|
+
elisp << ")" # /progn
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
381
406
|
end
|
data/lib/rcodetools/xmpfilter.rb
CHANGED
data/rcodetools.el
CHANGED
@@ -157,7 +157,10 @@ See also `rct-interactive'."
|
|
157
157
|
command opt (or rct-option-local "")
|
158
158
|
(rct-current-line)
|
159
159
|
;; specify column in BYTE
|
160
|
-
(string-bytes
|
160
|
+
(string-bytes
|
161
|
+
(encode-coding-string
|
162
|
+
(buffer-substring (point-at-bol) (point))
|
163
|
+
buffer-file-coding-system))
|
161
164
|
(if rct-use-test-script (rct-test-script-option-string) ""))
|
162
165
|
eval-buffer)
|
163
166
|
(message "")
|
data/rcodetools.elc
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rcodetools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rubikitch and Mauricio Fernandez
|
@@ -9,11 +9,21 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-18 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: |
|
17
|
+
rcodetools is a collection of Ruby code manipulation tools.
|
18
|
+
It includes xmpfilter and editor-independent Ruby development helper tools,
|
19
|
+
as well as emacs and vim interfaces.
|
20
|
+
|
21
|
+
Currently, rcodetools comprises:
|
22
|
+
* xmpfilter: Automagic Test::Unit assertions/RSpec expectations and code annotations
|
23
|
+
* rct-complete: Accurate method/class/constant etc. completions
|
24
|
+
* rct-doc: Document browsing and code navigator
|
25
|
+
* rct-meth-args: Precise method info (meta-prog. aware) and TAGS generation
|
26
|
+
|
17
27
|
email: "\"rubikitch\" <rubikitch@ruby-lang.org>, \"Mauricio Fernandez\" <mfp@acm.org>"
|
18
28
|
executables:
|
19
29
|
- rct-complete
|
@@ -176,6 +186,8 @@ files:
|
|
176
186
|
- test/data/xmpfilter/multi_line_annotation_5.taf
|
177
187
|
has_rdoc: true
|
178
188
|
homepage: http://eigenclass.org/hiki.rb?rcodetools
|
189
|
+
licenses: []
|
190
|
+
|
179
191
|
post_install_message: |+
|
180
192
|
|
181
193
|
==============================================================================
|
@@ -215,9 +227,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
227
|
requirements: []
|
216
228
|
|
217
229
|
rubyforge_project:
|
218
|
-
rubygems_version: 1.3.
|
230
|
+
rubygems_version: 1.3.2
|
219
231
|
signing_key:
|
220
|
-
specification_version:
|
232
|
+
specification_version: 3
|
221
233
|
summary: rcodetools is a collection of Ruby code manipulation tools
|
222
234
|
test_files:
|
223
235
|
- test/test_functional.rb
|