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

Evaluate Common Lisp in buffer's current package. #593

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions le-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
(declare-function slime-current-connection "ext:slime")
(declare-function slime-eval "ext:slime")
(declare-function slime-edit-definition "ext:slime")
(declare-function slime-current-package "ext:slime")
(declare-function sly-mrepl--find-buffer "ext:sly-mrepl")
(declare-function sly "ext:sly")
(declare-function sly-current-connection "ext:sly")
(declare-function sly-eval "ext:sly")
(declare-function sly-edit-definition "ext:sly")
(declare-function sly-current-package "ext:sly")

(defcustom lispy-use-sly nil
"Whether to use SLY instead of SLIME."
Expand All @@ -47,10 +49,13 @@
(defun lispy--eval-lisp (str)
"Eval STR as Common Lisp code."
(let* ((deactivate-mark nil)
(package (if (lispy--use-sly-p)
(sly-current-package)
(slime-current-package)))
(result (with-current-buffer (process-buffer (lispy--cl-process))
(if (lispy--use-sly-p)
(sly-eval `(slynk:eval-and-grab-output ,str))
(slime-eval `(swank:eval-and-grab-output ,str))))))
(sly-eval `(slynk:eval-and-grab-output ,str) package)
(slime-eval `(swank:eval-and-grab-output ,str) package)))))
(if (equal (car result) "")
(cadr result)
(concat (propertize (car result)
Expand Down