X-Git-Url: http://christophe.rhodes.io/gitweb/?p=swankr.git;a=blobdiff_plain;f=swank.R;h=13164853c32efb8a4c0c4086229a7431c6d99516;hp=e6e78c7e15996168ad9db03c1ab154c3d2dd9b9e;hb=eb2756730af853555a941d7acb595c07169f3524;hpb=2c0d53bc49f3dd18df3227759ba4ff40c8535ee5 diff --git a/swank.R b/swank.R index e6e78c7..1316485 100644 --- a/swank.R +++ b/swank.R @@ -272,10 +272,22 @@ printToString <- function(val) { list("R", "R") } +sendReplResult <- function(slimeConnection, value) { + string <- printToString(value) + sendToEmacs(slimeConnection, + list(quote(`:write-string`), + paste(string, collapse="\n"), + quote(`:repl-result`))) +} + +sendReplResultFunction <- sendReplResult + `swank:listener-eval` <- function(slimeConnection, sldbState, string) { - val <- eval(parse(text=string), envir = globalenv()) - string <- printToString(val) - sendToEmacs(slimeConnection, list(quote(`:write-string`), paste(string, collapse="\n"), quote(`:repl-result`))) + string <- gsub("#\\.\\(swank:lookup-presented-object-or-lose([^)]*)\\)", ".(`swank:lookup-presented-object-or-lose`(slimeConnection, sldbState,\\1))", string) + expr <- parse(text=string)[[1]] + lookedup <- do.call("bquote", list(expr)) + value <- eval(lookedup, envir = globalenv()) + sendReplResultFunction(slimeConnection, value) list() } @@ -337,9 +349,8 @@ computeRestartsForEmacs <- function (sldbState) { if(is.null(srcfile)) { list(quote(`:error`), "no srcfile") } else { - filename <- get("filename", srcfile) list(quote(`:location`), - list(quote(`:file`), filename), + list(quote(`:file`), sprintf("%s/%s", srcfile$wd, srcfile$filename)), list(quote(`:line`), srcref[[1]], srcref[[2]]-1), FALSE) }