Skip to content

Commit 4318ea9

Browse files
author
Antoine Brand
committed
* Now it is byte compilable
1 parent a8d93d7 commit 4318ea9

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

racket-mode.el

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,14 @@ http://www.gnu.org/licenses/ for details.")
144144
(set (make-local-variable 'imenu-syntax-alist)
145145
'(("+-*/.<>=?!$%_&~^:" . "w"))))
146146

147-
(when (fboundp 'helm)
148-
(require 'helm)
149147

150-
(defun racket-helm-apropos-init ()
151-
(with-current-buffer (helm-candidate-buffer 'global)
152-
(dolist (elem (racket--eval/sexpr ",apropos"))
153-
(insert (car elem) "\n"))))
148+
(when (require 'helm nil 't)
149+
150+
(when (fboundp 'helm-candidate-buffer)
151+
(defun racket-helm-apropos-init ()
152+
(with-current-buffer (helm-candidate-buffer 'global)
153+
(dolist (elem (racket--eval/sexpr ",apropos"))
154+
(insert (car elem) "\n")))))
154155

155156
(defun racket-helm-apropos-match-part (candidate)
156157
candidate)
@@ -166,10 +167,11 @@ http://www.gnu.org/licenses/ for details.")
166167
(match-part . racket-helm-apropos-match-part)
167168
(action . racket-helm-apropos-action)))
168169

169-
(defun racket-helm-apropos ()
170-
"Equivalent of helm-apropos but for the racket installed documentation"
171-
(interactive)
172-
(helm :sources 'helm-source-racket-apropos :buffer "*helm racket apropos*")))
170+
(when (fboundp 'helm)
171+
(defun racket-helm-apropos ()
172+
"Equivalent of helm-apropos but for the racket installed documentation"
173+
(interactive)
174+
(helm :sources 'helm-source-racket-apropos :buffer "*helm racket apropos*"))))
173175

174176
;;;###autoload
175177
(define-derived-mode racket-mode prog-mode

scribble.rkt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#lang racket/base
22

33
(require racket/file
4-
racket/list
4+
racket/list
55
racket/match
66
scribble/xref
77
setup/xref
88
(only-in xml xml->xexpr element xexpr->string)
99
(only-in html read-html-as-xml))
1010

1111
(provide scribble-doc/html
12-
scribble-decl-list)
12+
scribble-decl-list)
1313

1414
(define (scribble-decl-list)
15-
(define xref (fix-load-collections-xref))
15+
(define xref (load-collections-xref))
1616
(map entry-words (xref-index xref)))
1717

1818
(module+ test
@@ -33,16 +33,8 @@
3333
(define-values (path anchor) (binding->path+anchor stx))
3434
(and path anchor (scribble-get-xexpr path anchor)))
3535

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-
4436
(define (binding->path+anchor stx)
45-
(define xref (fix-load-collections-xref))
37+
(define xref (load-collections-xref))
4638
(define tag (and (identifier? stx)
4739
(xref-binding->definition-tag xref stx 0)))
4840
(cond [tag (xref-tag->path+anchor xref tag)]

0 commit comments

Comments
 (0)