Christophe Weblog Wiki Code Publications Music
implement swank:interactive-eval-region
authorChristophe Rhodes <csr21@cantab.net>
Wed, 6 Apr 2011 08:11:08 +0000 (09:11 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Wed, 6 Apr 2011 08:11:08 +0000 (09:11 +0100)
Because of our vaguely dodgy heuristic for finding the "defun" to
evaluate, C-c C-c is not terribly useful.  This allows at least C-c
C-r to be used without thinking.

swank.R

diff --git a/swank.R b/swank.R
index 34998b652e189799bc6bf70461099f50bc5d68eb..8c5bafdccd1d5d198f534d971db0455fba703095 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -494,6 +494,12 @@ withRetryRestart <- function(description, expr) {
   list(output, prin1ToString(value))
 }
 
+`swank:interactive-eval-region` <- function(slimeConnection, sldbState, string) {
+  withRetryRestart("retry SLIME interactive evaluation request",
+                   value <- eval(parse(text=string), envir=globalenv()))
+  prin1ToString(value)
+}
+
 `swank:find-definitions-for-emacs` <- function(slimeConnection, sldbState, string) {
   if(exists(string, envir = globalenv())) {
     thing <- get(string, envir = globalenv())