X-Git-Url: http://christophe.rhodes.io/gitweb/?p=swankr.git;a=blobdiff_plain;f=swank.R;h=7dd9d5c0a07676a70d433919acd376495b619ccc;hp=0384004ac87866fdf79bc4b99d072f954fde17ae;hb=732c94730278306081266f7dee21f39cb5e44e12;hpb=d71a219019f099e6c8a3be18e5ace3f06faaeded diff --git a/swank.R b/swank.R index 0384004..7dd9d5c 100644 --- a/swank.R +++ b/swank.R @@ -210,7 +210,14 @@ readSexpFromString <- function(string) { } else if(grepl("^[0-9]+\\.[0-9]+$", token)) { as.double(token) } else { - as.name(token) + name <- as.name(token) + if(name == quote(t)) { + TRUE + } else if(name == quote(nil)) { + FALSE + } else { + name + } } } readToken <- function() { @@ -304,8 +311,10 @@ sendReplResult <- function(slimeConnection, value) { 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)) value <- eval(lookedup, envir = globalenv()) sendReplResultFunction(slimeConnection, value) @@ -370,8 +379,16 @@ computeRestartsForEmacs <- function (sldbState) { if(is.null(srcfile)) { list(quote(`:error`), "no srcfile") } else { + filename <- get("filename", srcfile) + ## KLUDGE: what this means is "is the srcfile filename + ## absolute?" + if(substr(filename, 1, 1) == "/") { + file <- filename + } else { + file <- sprintf("%s/%s", srcfile$wd, filename) + } list(quote(`:location`), - list(quote(`:file`), sprintf("%s/%s", srcfile$wd, srcfile$filename)), + list(quote(`:file`), file), list(quote(`:line`), srcref[[1]], srcref[[2]]-1), FALSE) } @@ -681,3 +698,7 @@ emacsInspect.numeric <- function(numeric) { times <- system.time(parse(filename)) list(quote(`:compilation-result`), list(), TRUE, times[3], substitute(loadp), filename) } + +`swank:quit-lisp` <- function(slimeConnection, sldbState) { + quit() +}