Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* Added a helm interface to all the things return by xref-index #49

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmds.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
[(uq cmd)
(eq? 'unquote (syntax-e #'uq))
(case (syntax-e #'cmd)
[(apropos) (elisp-println (scribble-decl-list))]
[(run) (run put/stop rerun)]
[(top) (top put/stop rerun)]
[(def) (def (read))]
Expand Down
29 changes: 29 additions & 0 deletions racket-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,35 @@ http://www.gnu.org/licenses/ for details.")
(set (make-local-variable 'imenu-syntax-alist)
'(("+-*/.<>=?!$%_&~^:" . "w"))))


(when (require 'helm nil 't)

(when (fboundp 'helm-candidate-buffer)
(defun racket-helm-apropos-init ()
(with-current-buffer (helm-candidate-buffer 'global)
(dolist (elem (racket--eval/sexpr ",apropos"))
(insert (car elem) "\n")))))

(defun racket-helm-apropos-match-part (candidate)
candidate)

(defun racket-helm-apropos-action (candidate)
(racket--do-describe candidate t))

(defvar helm-source-racket-apropos
'((name . "Search throught racket defining symbol")
(init . racket-helm-apropos-init)
(candidates-in-buffer)
(get-line . buffer-substring)
(match-part . racket-helm-apropos-match-part)
(action . racket-helm-apropos-action)))

(when (fboundp 'helm)
(defun racket-helm-apropos ()
"Equivalent of helm-apropos but for the racket installed documentation"
(interactive)
(helm :sources 'helm-source-racket-apropos :buffer "*helm racket apropos*"))))

;;;###autoload
(define-derived-mode racket-mode prog-mode
"Racket"
Expand Down
8 changes: 7 additions & 1 deletion scribble.rkt
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#lang racket/base

(require racket/file
racket/list
racket/match
scribble/xref
setup/xref
(only-in xml xml->xexpr element xexpr->string)
(only-in html read-html-as-xml))

(provide scribble-doc/html)
(provide scribble-doc/html
scribble-decl-list)

(define (scribble-decl-list)
(define xref (load-collections-xref))
(map entry-words (xref-index xref)))

(module+ test
(require rackunit))
Expand Down