Christophe Weblog Wiki Code Publications Music
don't print out "locals" from the global environment
authorChristophe Rhodes <csr21@cantab.net>
Sun, 23 Oct 2011 09:54:19 +0000 (10:54 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Sun, 23 Oct 2011 09:54:19 +0000 (10:54 +0100)
This is important because e.g. the repl evaluation happens in the
global environment, so errors on code called from the repl will pull
up a backtrace with that evaluation frame, which can be inspected for
locals.  But printing out all the locals is a hugely expensive and not
helpful thing to do.

swank.R

diff --git a/swank.R b/swank.R
index ce757b3..c50114a 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -423,6 +423,9 @@ computeRestartsForEmacs <- function (sldbState) {
 `swank:frame-locals-and-catch-tags` <- function(slimeConnection, sldbState, index) {
   frame <- sldbState$frames[[1+index]]
   objs <- ls(envir=frame)
+  if(identical(frame, globalenv())) {
+    objs <- c()
+  }
   list(lapply(objs, function(name) { list(quote(`:name`), name,
                                           quote(`:id`), 0,
                                           quote(`:value`),