Skip to content

Commit

Permalink
Updates le-racket to changes in racket-mode api
Browse files Browse the repository at this point in the history
Fixes #561
  • Loading branch information
kiranandcode authored and abo-abo committed Jan 21, 2021
1 parent a361553 commit 38a7df4
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions le-racket.el
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,26 @@

(require 'racket-mode nil t)

(declare-function racket-lispy-visit-symbol-definition "ext:racket-edit")
(declare-function racket--cmd/async "exit:racket-repl")
(declare-function racket--cmd/async "ext:racket-repl")
(declare-function racket--repl-session-id "ext:racket-repl")

(defun lispy-goto-symbol-racket (symbol)
(racket-lispy-visit-symbol-definition symbol))
"Go to the definition of the SYMBOL."
(xref-find-definitions symbol))

(defun lispy--eval-racket (str)
"Evaluate STR in the context of the current racket repl session."
(let* ((awaiting 'RACKET-REPL-AWAITING)
(response awaiting))
(racket--cmd/async
`(eval ,str)
(lambda (v)
(setq response v)))
(racket--cmd/async (racket--repl-session-id)
`(eval ,str)
(lambda (v)
(setq response v)))
(with-timeout (1
(error "racket-command process timeout"))
(while (eq response awaiting)
(accept-process-output nil 0.001))
(substring response 1 -2))))
response)))

(defun lispy-eval-racket ()
(lispy--eval-racket (lispy--string-dwim)))
Expand Down

0 comments on commit 38a7df4

Please # to comment.