File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 40
40
[(uq cmd)
41
41
(eq? 'unquote (syntax-e #'uq ))
42
42
(case (syntax-e #'cmd )
43
+ [(apropos) (elisp-println (scribble-decl-list))]
43
44
[(run) (run put/stop rerun)]
44
45
[(top) (top put/stop rerun)]
45
46
[(def) (def (read))]
Original file line number Diff line number Diff line change @@ -144,6 +144,32 @@ http://www.gnu.org/licenses/ for details.")
144
144
(set (make-local-variable 'imenu-syntax-alist )
145
145
'((" +-*/.<>=?!$%_&~^:" . " w" ))))
146
146
147
+ (require 'helm )
148
+
149
+ (defun helm-racket-apropos-init ()
150
+ (with-current-buffer (helm-candidate-buffer 'global )
151
+ (dolist (elem (racket--eval/sexpr " ,apropos" ))
152
+ (insert (car elem) " \n " ))))
153
+
154
+ (defun helm-racket-apropos-match-part (candidate )
155
+ candidate)
156
+
157
+ (defun helm-racket-apropos-action (candidate )
158
+ (racket--do-describe candidate t ))
159
+
160
+ (defvar helm-source-racket-apropos
161
+ '((name . " Search throught racket defining symbol" )
162
+ (init . helm-racket-apropos-init)
163
+ (candidates-in-buffer)
164
+ (get-line . buffer-substring)
165
+ (match-part . helm-racket-apropos-match-part)
166
+ (action . helm-racket-apropos-action)))
167
+
168
+ (defun helm-racket-apropos ()
169
+ " Equivalent of helm-apropos but for the racket installed documentation"
170
+ (interactive )
171
+ (helm :sources 'helm-source-racket-apropos :buffer " *helm racket apropos*" ))
172
+
147
173
;;;### autoload
148
174
(define-derived-mode racket-mode prog-mode
149
175
" Racket"
Original file line number Diff line number Diff line change 1
1
#lang racket/base
2
2
3
3
(require racket/file
4
+ racket/list
4
5
racket/match
5
6
scribble/xref
6
7
setup/xref
7
8
(only-in xml xml->xexpr element xexpr->string)
8
9
(only-in html read-html-as-xml))
9
10
10
- (provide scribble-doc/html)
11
+ (provide scribble-doc/html
12
+ scribble-decl-list)
13
+
14
+ (define (scribble-decl-list)
15
+ (define xref (fix-load-collections-xref))
16
+ (map entry-words (xref-index xref)))
11
17
12
18
(module+ test
13
19
(require rackunit))
27
33
(define-values (path anchor) (binding->path+anchor stx))
28
34
(and path anchor (scribble-get-xexpr path anchor)))
29
35
36
+ (define fix-xref #f )
37
+
38
+ (define (fix-load-collections-xref)
39
+ (when (not fix-xref)
40
+ (set! fix-xref (load-collections-xref))
41
+ (void (xref-index fix-xref)))
42
+ fix-xref)
43
+
30
44
(define (binding->path+anchor stx)
31
- (define xref (load-collections-xref))
45
+ (define xref (fix- load-collections-xref))
32
46
(define tag (and (identifier? stx)
33
47
(xref-binding->definition-tag xref stx 0 )))
34
48
(cond [tag (xref-tag->path+anchor xref tag )]
You can’t perform that action at this time.
0 commit comments