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

feat(lisp-mode): Add command to eval buffer #668

Merged
merged 1 commit into from
Jun 3, 2023
Merged
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
7 changes: 7 additions & 0 deletions modes/lisp-mode/lisp-mode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@
(self-interactive-eval string)))))

(define-command lisp-eval-defun () ()
"Evaluate top-level form around point and instrument."
(check-connection)
(with-point ((point (current-point)))
(lem-lisp-syntax:top-of-defun point)
Expand All @@ -424,16 +425,22 @@
(interactive-eval string))))))

(define-command lisp-eval-region (start end) ("r")
"Execute the region as Lisp code."
(check-connection)
(eval-with-transcript
`(swank:interactive-eval-region
,(points-to-string start end))))

(define-command lisp-eval-buffer () ()
"Execute the accessible portion of current buffer as Lisp code."
(lisp-eval-region (buffer-start-point (current-buffer)) (buffer-end-point (current-buffer))))

(define-command lisp-load-file (filename)
((prompt-for-file "Load File: "
:directory (or (buffer-filename) (buffer-directory))
:default nil
:existing t))
"Load the Lisp file named FILENAME."
(check-connection)
(when (uiop:file-exists-p filename)
(let ((filename (convert-local-to-remote-file filename)))
Expand Down