Christophe Weblog Wiki Code Publications Music
deal with 0 or multiple expressions at the repl
[swankr.git] / swank.R
diff --git a/swank.R b/swank.R
index cf64daaaa81b8ad7341284a67dd67423058c922f..b5c79c78204695667f421bbceb3b3e83664971c1 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -324,12 +324,14 @@ sendReplResultFunction <- sendReplResult
 `swank:listener-eval` <- function(slimeConnection, sldbState, string) {
   ## O how ugly
   string <- gsub("#\\.\\(swank:lookup-presented-object-or-lose([^)]*)\\)", ".(`swank:lookup-presented-object-or-lose`(slimeConnection, sldbState,\\1))", string)
-  expr <- parse(text=string)[[1]]
-  ## O maybe this is even uglier
-  lookedup <- do.call("bquote", list(expr))
-  tmp <- withVisible(eval(lookedup, envir = globalenv()))
-  if(tmp$visible) {
-    sendReplResultFunction(slimeConnection, tmp$value)
+  for(expr in parse(text=string)) {
+    expr <- expr
+    ## O maybe this is even uglier
+    lookedup <- do.call("bquote", list(expr))
+    tmp <- withVisible(eval(lookedup, envir = globalenv()))
+    if(tmp$visible) {
+      sendReplResultFunction(slimeConnection, tmp$value)
+    }
   }
   list()
 }