rrse 0.6.1 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.ja +18 -10
- data/README.ja.md +103 -0
- data/bin/rrse +4 -0
- data/elisp/rrse.el +89 -217
- data/lib/rrse.rb +11 -0
- data/lib/rrse/database.rb +38 -0
- data/lib/rrse/install-default-db-command.rb +29 -0
- data/lib/rrse/main.rb +69 -0
- data/lib/rrse/pipe-query-command.rb +42 -0
- data/lib/rrse/query-command.rb +36 -0
- data/lib/rrse/setup-command.rb +34 -0
- data/lib/rrse/standalone-query-command.rb +41 -0
- data/lib/rrse/update-db-command.rb +114 -0
- data/misc/index_table +1 -0
- data/misc/table +1 -11813
- metadata +39 -25
- data/README.ja +0 -102
- data/bin/rrse-bitclust-listdescs +0 -84
- data/bin/rrse-make-table +0 -79
- data/bin/rrse-merge-tables +0 -17
- data/bin/rrse-rd-listdescs +0 -56
- data/bin/rrse-ri-listdescs +0 -117
- data/bin/rrse-table +0 -194
- data/misc/rev-table +0 -5661
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24f46b3b51a2531892be03a50af2a20c30d3e04d
|
4
|
+
data.tar.gz: 73cf2b81f457be12b66986b78410239319dd3dc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2edbfb2d4daeab699098df3691c26e15b5ddc154af9e2a9e79aa32ea5d65e06e3eb3cf1491e001a6a28285fe3ca664c9d7e3c94761780ede1dfc99deb7965f56
|
7
|
+
data.tar.gz: 83aba0a35700c570310e96bdd324dce9cc2134fa2775bfbe7d7839140415a46c8243e3957fc806bb75d86aed4a628be429c241d4c8c64abfad1aeaf70cb636f0
|
data/NEWS.ja
CHANGED
@@ -1,22 +1,30 @@
|
|
1
|
+
0.7 (2017/9):
|
2
|
+
* ������¤�������˹���
|
3
|
+
* �Ȥ�ʤ��ʤä���ǽ����(rd���ɤ��Ȥ�)
|
4
|
+
* ri�Υǡ����Ϥ��Ǥ˻Ȥ��ʤ��ä��ΤǤ������
|
5
|
+
* ���֤Υץ������ȤäƤ���ΤϺ�Ԥ������ʤ��Ȼפ��ޤ�����
|
6
|
+
��������ȤäƤ�������1���饤�ȡ��뤷���ۤ����褤�Ȼפ��ޤ�
|
7
|
+
* help��ƤӽФ���ǽ����(��ä�¾�Υġ���Τۤ��������Ǥ��礦)
|
8
|
+
|
1
9
|
0.5:
|
2
|
-
bitclust �Υǡ��������ѤǤ���褦�ˤ���
|
10
|
+
* bitclust �Υǡ��������ѤǤ���褦�ˤ���
|
3
11
|
|
4
12
|
0.4:
|
5
|
-
RD�Υǡ��������ѤǤ���褦�ˤ���
|
13
|
+
* RD�Υǡ��������ѤǤ���褦�ˤ���
|
6
14
|
|
7
15
|
0.3:
|
8
|
-
ri �Υǡ��������ѤǤ���褦�ˤ���
|
9
|
-
rrse-make-tables �Ǥ��餫����ǡ�������ʤ���Фʤ�ʤ��褦�ˤ���
|
16
|
+
* ri �Υǡ��������ѤǤ���褦�ˤ���
|
17
|
+
* rrse-make-tables �Ǥ��餫����ǡ�������ʤ���Фʤ�ʤ��褦�ˤ���
|
10
18
|
|
11
19
|
0.2:
|
12
|
-
�Ķ��ѿ� REFE_DATA_DIR ���������Ƥ�����Ϥ��Υǥ��쥯�ȥ�ˤ���
|
13
|
-
�ǡ�����Ȥ��褦�ˤ���
|
20
|
+
* �Ķ��ѿ� REFE_DATA_DIR ���������Ƥ�����Ϥ��Υǥ��쥯�ȥ�ˤ���
|
21
|
+
* �ǡ�����Ȥ��褦�ˤ���
|
14
22
|
|
15
|
-
rrse-refe-listdescs �����Ƥ餫����ե�����˽��Ϥ��Ƥ������Ȥ�
|
16
|
-
|
23
|
+
* rrse-refe-listdescs �����Ƥ餫����ե�����˽��Ϥ��Ƥ������Ȥ�
|
24
|
+
��ư�ι�®����ޤä�
|
17
25
|
|
18
26
|
0.1.1:
|
19
|
-
rrb-show-minibuffer-help:rrse.el �ΥХ�����
|
27
|
+
* rrb-show-minibuffer-help:rrse.el �ΥХ�����
|
20
28
|
|
21
29
|
0.1:
|
22
|
-
�ǽ�Υ���
|
30
|
+
* �ǽ�Υ���
|
data/README.ja.md
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# Ruby Reference Seeker for Emacsen 0.7
|
2
|
+
|
3
|
+
## ����ϲ�����
|
4
|
+
���Υġ���ϡ�bitclust�ξ���ˤ�ȤŤ���Emacs�Υߥ˥Хåե���
|
5
|
+
Ruby�Υ�åɤδ�ñ�ʥإ�פ�ɽ������ġ���Ǥ���
|
6
|
+
|
7
|
+
## bitclust�Ȥϲ�����
|
8
|
+
bitclust �� Ruby��ե���ޥ˥奢������ײ� (�̾Τ���) ��
|
9
|
+
�ޥ˥奢����갷������Υץ������Ǥ���
|
10
|
+
�ܤ����� https://github.com/rurema/doctree/wiki �ʤɤȤ��Ƥ���������
|
11
|
+
|
12
|
+
## ư��Ķ�
|
13
|
+
* Emacs (24.5.1�dz�ǧ)
|
14
|
+
* Ruby (2.4.2�dz�ǧ)
|
15
|
+
|
16
|
+
## ���ȡ���
|
17
|
+
|
18
|
+
�ޤ�
|
19
|
+
|
20
|
+
gem install rrse
|
21
|
+
|
22
|
+
�� gem �ȡ��뤷�ޤ���gem �Υѥå������� elisp/rrse.el �Ȥ���
|
23
|
+
�ե����뤬�ޤޤ�Ƥ��ޤ��Τǡ����� rrse.el ��
|
24
|
+
Emacs �� load-path ���̤ä���˥��ԡ����Ƥ���������
|
25
|
+
|
26
|
+
gem contents rrse | grep rrse.el
|
27
|
+
|
28
|
+
�Ǥɤ��˥ե����뤬�֤���Ƥ��뤫�狼��ޤ���
|
29
|
+
|
30
|
+
���˥ǡ����١�����������ޤ���rrse��ź�դ��Ƥ���ǡ����١�����
|
31
|
+
|
32
|
+
rrse setup-config
|
33
|
+
rrse install-default-db
|
34
|
+
|
35
|
+
�ǥ��ȡ���Ǥ��ޤ���
|
36
|
+
|
37
|
+
�ǿ���rurema�ξ����Ȥ���������bitclust��Ȥ��ޤ����ޤ� bitclust ��
|
38
|
+
|
39
|
+
bitclust setup
|
40
|
+
|
41
|
+
�ǥ��åȥ��åפ��Ƥ���
|
42
|
+
|
43
|
+
rrse-table setup-config
|
44
|
+
rrse-table update-db
|
45
|
+
|
46
|
+
�ǥǡ����١��������ۤ���ޤ���
|
47
|
+
|
48
|
+
�ɤ���ξ��Ǥ� $HOME/.rrse/ �ʲ�������ե������ rrse �ѥǡ����١�����
|
49
|
+
����ޤ���
|
50
|
+
|
51
|
+
### Emacs ¦�Υ��ȡ���
|
52
|
+
���� emacs �ν�����ե�����(.emacs.d/init.el�ʤ�)��
|
53
|
+
|
54
|
+
(load-library "rrse")
|
55
|
+
(rrse-setup)
|
56
|
+
|
57
|
+
�ȽƤ����������ޤ���ruby�ѤΥ⡼�ɤȤ���ruby-mode�ʳ�(enhanced-ruby-mode�ʤ�)
|
58
|
+
��ȤäƤ������ϡ�
|
59
|
+
|
60
|
+
* rrse-ruby-mode
|
61
|
+
* rrse-ruby-mode-hook
|
62
|
+
|
63
|
+
��Ŭ�ڤ����ꤹ��ɬ�פ�����ޤ����㤨�� enh-ruby-mode��Ȥ����ϡ�
|
64
|
+
`(rrse-setup)` �ιԤ�����
|
65
|
+
|
66
|
+
(setq rrse-ruby-mode 'enh-ruby-mode)
|
67
|
+
(setq rrse-ruby-mode-hook 'enh-ruby-mode-hook)
|
68
|
+
|
69
|
+
�Ȥ���2�Ԥ�ä��Ƥ���������
|
70
|
+
|
71
|
+
|
72
|
+
## �Ȥ���
|
73
|
+
|
74
|
+
ruby-mode ��ư����
|
75
|
+
��å�̾�ξ�˥����������äƤ����Ȥ��Υ�åɤ�
|
76
|
+
���� "���饹#��å�̾(����)" �Ȥ������ǥߥ˥Хåե���ɽ������ޤ���
|
77
|
+
|
78
|
+
Ʊ��̾���Υ�åɤ�ʣ��������Ϥ��줬����ɽ������ޤ���
|
79
|
+
|
80
|
+
�ޤ������ξ��֤� M-x rrse-help �Ȥ���ȡ�ɽ������Ƥ����å�
|
81
|
+
�Υ�ե���� ReFe �ǰ������Ȥ��Ǥ��ޤ���
|
82
|
+
|
83
|
+
M-x rrse-toggle-show �ǥߥ˥Хåե���ɽ����ͭ����������̵����������Ǥ��ޤ���
|
84
|
+
|
85
|
+
## �饤����
|
86
|
+
GNU GPL 2 or later
|
87
|
+
|
88
|
+
������ misc/ �ʲ��Ϥ��ޤΥǡ����Ǥ��뤿�ᡢ������������
|
89
|
+
�饤���� (CC BY 3.0) ��Ŭ�Ѥ���ޤ���
|
90
|
+
|
91
|
+
## �ռ��ʤ�
|
92
|
+
��������β��ξ����ɽ������Ȥ��������ǥ��� haskell-mode ����
|
93
|
+
�Ҽڤ��ޤ�����
|
94
|
+
�ޤ����͡��ʥҥ�Ȥ���ӥѥå����ä�rubikitch�����
|
95
|
+
�Х���ݡ��Ȥ��ä� dfft����˴��դ��ޤ���
|
96
|
+
|
97
|
+
## �Х��ʤ�
|
98
|
+
�Х�����˾�ʤɤϺ�Ԥ˥��Ƥ���������
|
99
|
+
|
100
|
+
## ��ԤˤĤ���
|
101
|
+
|
102
|
+
���Ӱ�ʿ <ohai@kmc.gr.jp>
|
103
|
+
http://www.kmc.gr.jp/~ohai/
|
data/bin/rrse
ADDED
data/elisp/rrse.el
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
-
;;; rrse --- Ruby Reference|Refe Searcher for Emacsen
|
2
1
|
|
3
|
-
|
2
|
+
;;; rrse.el --- Ruby Reference Searcher for Emacsen
|
4
3
|
|
5
|
-
;;
|
4
|
+
;; Copyright (C) 2017 by Ippei Obayashi
|
5
|
+
|
6
|
+
;; Author: Ippei Obayashi <ohai@kmc.gr.jp>
|
6
7
|
;; URL: http://www.kmc.gr.jp/~ohai/rrse.html
|
8
|
+
;; Version: 0.7
|
9
|
+
;; Package-Requires: ()
|
7
10
|
|
8
11
|
;; This software is distributed under GNU general Public Licence version 2 or later.
|
9
12
|
;;
|
@@ -12,254 +15,123 @@
|
|
12
15
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
16
|
;; GNU General Public License for more details.
|
14
17
|
|
15
|
-
|
16
|
-
|
17
18
|
;;; Code:
|
18
19
|
|
19
|
-
|
20
|
-
(defvar rrse-desc-separator " "
|
21
|
-
"*Separator for each description")
|
22
|
-
|
23
|
-
(defvar rrse-refe-program-name
|
24
|
-
(if (featurep 'meadow)
|
25
|
-
"ruby"
|
26
|
-
"refe"))
|
27
|
-
|
28
|
-
(defvar rrse-refe-program-args
|
29
|
-
(if (featurep 'meadow)
|
30
|
-
'("-S" "refe")
|
31
|
-
nil))
|
20
|
+
(provide 'rrse)
|
32
21
|
|
33
|
-
|
34
|
-
|
35
|
-
(defvar rrse-refe-coding-system locale-coding-system)
|
22
|
+
;;;; User customizable varaible
|
36
23
|
|
24
|
+
(defcustom rrse-idle-delay 0.5 "RRSE delay seconds")
|
25
|
+
(defcustom rrse-ruby-mode 'ruby-mode "Major mode for RRSE")
|
26
|
+
(defcustom rrse-ruby-mode-hook 'ruby-mode-hook "Major mode hook for RRSE")
|
27
|
+
(defcustom rrse-directory "~/.rrse" "RRSE directory")
|
37
28
|
|
38
29
|
;;;; Internal variables
|
39
|
-
|
40
|
-
(defvar rrse-refe-buffer-name "*rrse-help*")
|
41
|
-
|
42
|
-
(defvar rrse-forward-table nil)
|
43
|
-
(defvar rrse-rev-table nil)
|
44
|
-
|
45
30
|
(defvar rrse-enable t)
|
31
|
+
(defvar rrse-program-name "rrse")
|
32
|
+
(defvar rrse-process-buffer nil)
|
33
|
+
(defvar rrse-process nil)
|
34
|
+
(defvar rrse-query-timeout 5)
|
46
35
|
|
47
|
-
|
48
|
-
(defvar rrse-rev-table-file "~/.rrse/rev-table")
|
49
|
-
|
50
|
-
;;;; Utitility functions
|
51
|
-
(defun rrse-id-char-p (c)
|
52
|
-
"Return whether character C is in [a-zA-Z0-9_]"
|
53
|
-
(or (and (<= ?a c) (<= c ?z))
|
54
|
-
(and (<= ?A c) (<= c ?Z))
|
55
|
-
(and (<= ?0 c) (<= c ?9))
|
56
|
-
(= ?_ c)))
|
57
|
-
|
58
|
-
(defun rrse-chomp (str)
|
59
|
-
(if (string-match "\\(\r\\|\n\\)$" str)
|
60
|
-
(substring str 0 (match-beginning 0))
|
61
|
-
str))
|
62
|
-
|
63
|
-
(defun rrse-each-line (fun)
|
64
|
-
"Apply FUN to each line in current buffer"
|
65
|
-
(goto-char (point-min))
|
66
|
-
(while (not (eobp))
|
67
|
-
(funcall fun (rrse-chomp (thing-at-point 'line)))
|
68
|
-
(forward-line)))
|
69
|
-
|
70
|
-
|
71
|
-
(defun rrse-chomp-string (str)
|
72
|
-
"remove \\n from STR's tail"
|
73
|
-
(if (eq (aref str (- (length str) 1)) ?\n)
|
74
|
-
(substring str 0 (- (length str) 1))
|
75
|
-
str))
|
76
|
-
|
77
|
-
(defun rrse-refe-call-process (buf &rest args)
|
78
|
-
"Call refe"
|
79
|
-
(let ((coding-system-for-read rrse-refe-coding-system))
|
80
|
-
(apply 'call-process rrse-refe-program-name nil buf nil
|
81
|
-
(append rrse-refe-program-args args))))
|
82
|
-
|
83
|
-
(defun rrse-bsearch (table word begin end)
|
84
|
-
"binary search implementation"
|
85
|
-
(if (or (= (+ begin 1) end) (= begin end))
|
86
|
-
(cond
|
87
|
-
((string= word (car (aref table begin))) (cdr (aref table begin)))
|
88
|
-
((string= word (car (aref table end))) (cdr (aref table end)))
|
89
|
-
(t nil))
|
90
|
-
(let ((center (/ (+ begin end) 2)))
|
91
|
-
(if (string< (car (aref table center)) word)
|
92
|
-
(rrse-bsearch table word (+ center 1) end)
|
93
|
-
(rrse-bsearch table word begin center)))))
|
94
|
-
|
95
|
-
|
96
|
-
(defun rrse-search (key table)
|
97
|
-
"binary search"
|
98
|
-
(rrse-bsearch table key 0 (- (length table) 1)))
|
99
|
-
|
100
|
-
(defun rrse-filter (fun list)
|
101
|
-
"a list of all elements that satisfy (FUN elem) in LIST"
|
102
|
-
(let ((head list)
|
103
|
-
(result nil))
|
104
|
-
(while head
|
105
|
-
(if (funcall fun (car head))
|
106
|
-
(setq result (cons (car head) result)))
|
107
|
-
(setq head (cdr head)))
|
108
|
-
(reverse result)))
|
109
|
-
|
110
|
-
;;;; Table Creation
|
111
|
-
(defun rrse-make-table ()
|
112
|
-
(with-temp-buffer
|
113
|
-
(if (file-exists-p rrse-table-file)
|
114
|
-
(insert-file-contents rrse-table-file)
|
115
|
-
(error "can't load %s" rrse-table-file))
|
116
|
-
(let ((table (make-vector (count-lines (point-min) (point-max)) nil)))
|
117
|
-
(rrse-each-line (lambda (line)
|
118
|
-
(aset table (count-lines (point-min) (point))
|
119
|
-
(split-string line "[\t\n]"))))
|
120
|
-
table)))
|
121
|
-
|
122
|
-
(defun rrse-make-rev-table ()
|
123
|
-
(with-temp-buffer
|
124
|
-
(if (file-exists-p rrse-rev-table-file)
|
125
|
-
(insert-file-contents rrse-rev-table-file)
|
126
|
-
(error "can't load %s" rrse-rev-table-file))
|
127
|
-
(let ((table (make-vector (count-lines (point-min) (point-max)) nil)))
|
128
|
-
(rrse-each-line (lambda (line)
|
129
|
-
(aset table (count-lines (point-min) (point))
|
130
|
-
(split-string line "[\t\n]"))))
|
131
|
-
table)))
|
132
|
-
|
133
|
-
(defun rrse-prepare-table ()
|
134
|
-
(if (null rrse-forward-table)
|
135
|
-
(setq rrse-forward-table (rrse-make-table)
|
136
|
-
rrse-rev-table (rrse-make-rev-table))))
|
137
|
-
|
138
|
-
;;;; Find suitable methods
|
139
|
-
|
36
|
+
;;;; Functions
|
140
37
|
(defun rrse-get-current-word ()
|
38
|
+
"Return the word at the point"
|
141
39
|
(save-excursion
|
142
40
|
(buffer-substring-no-properties
|
143
41
|
(progn (skip-syntax-backward "w_") (point))
|
144
42
|
(progn (skip-syntax-forward "w_") (point)))))
|
145
43
|
|
146
|
-
(defun rrse-
|
147
|
-
|
148
|
-
(while (and (memq (char-before) '(?\t ?\ ?\n)) (> (point) (point-min)))
|
149
|
-
(backward-char)))
|
150
|
-
|
151
|
-
(defun rrse-find-dot ()
|
44
|
+
(defun rrse-method-call-p ()
|
45
|
+
"Return true if the current word is a method call by using dot"
|
152
46
|
(save-excursion
|
153
|
-
(
|
154
|
-
(
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
47
|
+
(skip-syntax-backward "w_")
|
48
|
+
(skip-syntax-backward " ")
|
49
|
+
(eq (char-before) ?.)))
|
50
|
+
|
51
|
+
(defun rrse-get-receiver ()
|
52
|
+
"Return the receiver of the method call at the cursor"
|
53
|
+
(when (rrse-method-call-p)
|
159
54
|
(save-excursion
|
160
|
-
(
|
55
|
+
(skip-syntax-backward "w_")
|
56
|
+
(skip-syntax-backward " ")
|
161
57
|
(backward-char)
|
162
|
-
(let ((end (point)))
|
58
|
+
(let ((receiver-end-point (point)))
|
163
59
|
(skip-syntax-backward "w_")
|
164
|
-
(buffer-substring-no-properties (point) end)))))
|
165
|
-
|
166
|
-
(defun rrse-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
(defun rrse-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
(
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
(
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
(
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
(
|
213
|
-
|
214
|
-
(if descs
|
215
|
-
(message "%s" (rrse-format-descs descs)))))
|
216
|
-
|
60
|
+
(buffer-substring-no-properties (point) receiver-end-point)))))
|
61
|
+
|
62
|
+
(defun rrse-start-process (buffer)
|
63
|
+
"Invoke \"rrse pipe-query\""
|
64
|
+
(start-process "rrse" buffer
|
65
|
+
rrse-program-name "-d" (expand-file-name rrse-directory)
|
66
|
+
"pipe-query" "-s" " "))
|
67
|
+
|
68
|
+
(defun rrse-init-process ()
|
69
|
+
"Invoke \"rrse pipe-query\" if rrse-process is nil and set rrse-process"
|
70
|
+
(when (not rrse-process)
|
71
|
+
(setq rrse-process-buffer (get-buffer-create " *rrse*"))
|
72
|
+
(setq rrse-process (rrse-start-process rrse-process-buffer))
|
73
|
+
(set-process-coding-system rrse-process 'utf-8-unix 'utf-8-unix)
|
74
|
+
(set-process-query-on-exit-flag rrse-process nil)))
|
75
|
+
|
76
|
+
(defun rrse-kill-process ()
|
77
|
+
"Kill rrse pipe-query process if the process is alive"
|
78
|
+
(when (and rrse-process (eq (process-status rrse-process) 'run))
|
79
|
+
(kill-process rrse-process)
|
80
|
+
(setq rrse-process nil)
|
81
|
+
(when (get-buffer rrse-process-buffer)
|
82
|
+
(kill-buffer rrse-process-buffer))))
|
83
|
+
|
84
|
+
(defun rrse-query (type query)
|
85
|
+
"Query to rrse"
|
86
|
+
(rrse-init-process)
|
87
|
+
(with-current-buffer (process-buffer rrse-process)
|
88
|
+
(delete-region (point-min) (point-max))
|
89
|
+
(process-send-string rrse-process (concat type " " query "\n"))
|
90
|
+
(while (not (eq (char-before (point-max)) ?\n))
|
91
|
+
(accept-process-output rrse-process 0 rrse-query-timeout))
|
92
|
+
(let ((msg (buffer-substring-no-properties (point-min) (1- (point-max)))))
|
93
|
+
(if (string= msg "") nil msg))))
|
94
|
+
|
95
|
+
(defun rrse-debug-message ()
|
96
|
+
(concat (rrse-get-current-word)
|
97
|
+
" "
|
98
|
+
(if (rrse-method-call-p) "1" "0")
|
99
|
+
" "
|
100
|
+
(rrse-get-receiver)))
|
101
|
+
|
102
|
+
(defun rrse-build-minibuffer-help ()
|
103
|
+
"Return help string for minibuffer from the method at the cursor"
|
104
|
+
(let ((word (rrse-get-current-word))
|
105
|
+
(receiver (rrse-get-receiver)))
|
106
|
+
(if (rrse-method-call-p)
|
107
|
+
(or (rrse-query "full-name" (concat receiver "." word))
|
108
|
+
(rrse-query "instance-method" word))
|
109
|
+
(rrse-query "toplevel-method" word))))
|
217
110
|
|
218
111
|
(defun rrse-print-current-symbol-info ()
|
112
|
+
"Show the information of the method call at the cursor in the minibuffer"
|
219
113
|
(interactive)
|
220
114
|
(condition-case err
|
221
115
|
(and rrse-enable
|
222
|
-
(eq major-mode
|
116
|
+
(eq major-mode rrse-ruby-mode)
|
223
117
|
(not executing-kbd-macro)
|
224
118
|
(not (eq (selected-window) (minibuffer-window)))
|
225
119
|
(sit-for rrse-idle-delay)
|
226
|
-
(rrse-
|
120
|
+
(let ((minibuffer-help (rrse-build-minibuffer-help)))
|
121
|
+
(when minibuffer-help (message minibuffer-help))))
|
227
122
|
(error (princ err) (error "stop hook"))))
|
228
123
|
|
229
|
-
;;;; show refe's help
|
230
|
-
(defun rrse-show-help (method)
|
231
|
-
(let ((buf (or (get-buffer rrse-refe-buffer-name)
|
232
|
-
(generate-new-buffer rrse-refe-buffer-name))))
|
233
|
-
(set-buffer buf)
|
234
|
-
(setq buffer-read-only nil)
|
235
|
-
(erase-buffer)
|
236
|
-
(rrse-refe-call-process buf method)
|
237
|
-
(goto-char (point-min))
|
238
|
-
(set-buffer-modified-p nil)
|
239
|
-
(setq buffer-read-only t)
|
240
|
-
(display-buffer buf)))
|
241
|
-
|
242
|
-
(defun rrse-help-completing-read (methods)
|
243
|
-
(completing-read "Method: " (mapcar 'list methods)))
|
244
|
-
|
245
|
-
(defun rrse-help ()
|
246
|
-
(interactive)
|
247
|
-
(let ((methods (rrse-find-specs)))
|
248
|
-
(cond
|
249
|
-
((null methods) nil)
|
250
|
-
((null (cdr methods)) (rrse-show-help (car methods)))
|
251
|
-
(t (rrse-show-help (rrse-help-completing-read methods))))))
|
252
|
-
|
253
|
-
;;;; toggle rrse
|
254
124
|
(defun rrse-toggle-show ()
|
255
125
|
"Toggle whether documents are shown in minibuffer"
|
256
126
|
(interactive)
|
257
127
|
(setq rrse-enable (not rrse-enable)))
|
258
128
|
|
259
|
-
;;;; setup function
|
260
129
|
(defun rrse-setup ()
|
130
|
+
"Setup rrse in emacs"
|
261
131
|
(interactive)
|
262
|
-
(add-hook
|
132
|
+
(add-hook rrse-ruby-mode-hook
|
263
133
|
'(lambda ()
|
264
|
-
(rrse-prepare-table)
|
265
134
|
(add-hook 'post-command-hook 'rrse-print-current-symbol-info))))
|
135
|
+
|
136
|
+
;;; rrse.el ends here
|
137
|
+
|