Skip to content

add some lispy support #374

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

Merged
merged 2 commits into from
May 20, 2019
Merged
Changes from 1 commit
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
24 changes: 16 additions & 8 deletions racket-edit.el
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,22 @@ Please keep in mind the following limitations:
(interactive "P")
(pcase (racket--symbol-at-point-or-prompt prefix "Visit definition of: ")
(`nil nil)
(str (if (and (eq major-mode 'racket-mode)
(not (equal (racket--repl-file-name+md5)
(cons (racket--buffer-file-name t) (md5 (current-buffer)))))
(y-or-n-p "Run current buffer first? "))
(racket--repl-run nil nil
(lambda (_n/a)
(racket--do-visit-def-or-mod 'def str)))
(racket--do-visit-def-or-mod 'def str)))))
(str (racket--visit-symbol-definition str))))

(defsubst racket-lispy-visit-symbol-definition (str)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a plain old defun instead? Genuine question; I'm not sure. (Inlining across packages seems like it could be trouble. e.g. Someday we need to change this. We do. User updates racket-mode package. But. That doesn't mean lispy package necessarily gets recompiled then. Ergo confusion.)

"Function called by lispy.el's `lispy-goto-symbol' for Racket
symbol definition lookup."
(racket--visit-symbol-definition str))

(defun racket--visit-symbol-definition (str)
(if (and (eq major-mode 'racket-mode)
(not (equal (racket--repl-file-name+md5)
(cons (racket--buffer-file-name t) (md5 (current-buffer)))))
(y-or-n-p "Run current buffer first? "))
(racket--repl-run nil nil
(lambda (_n/a)
(racket--do-visit-def-or-mod 'def str)))
(racket--do-visit-def-or-mod 'def str)))

(defun racket-visit-module (&optional prefix)
"Visit definition of module at point, e.g. net/url or \"file.rkt\".
Expand Down