From: Christophe Rhodes Date: Sat, 11 Sep 2010 09:58:10 +0000 (+0100) Subject: implement swank:inspector-eval X-Git-Url: http://christophe.rhodes.io/gitweb/?a=commitdiff_plain;h=8d84cee073ab58c2c858a6aac994a4f88d91ddb4;p=swankr.git implement swank:inspector-eval It took me quite some time to remember that parse returns a list of expressions rather than just a single expression... --- diff --git a/swank.R b/swank.R index ce85b69..3ab65ee 100644 --- a/swank.R +++ b/swank.R @@ -576,3 +576,14 @@ emacsInspect.numeric <- function(numeric) { FALSE } } + +`swank:inspector-eval` <- function(slimeConnection, sldbState, string) { + expr <- parse(text=string)[[1]] + object <- slimeConnection$istate$object + if(inherits(object, "list")|inherits(object, "environment")) { + substituted <- substituteDirect(expr, object) + eval(substituted, envir=globalenv()) + } else { + eval(expr, envir=globalenv()) + } +}