X-Git-Url: http://christophe.rhodes.io/gitweb/?p=swankr.git;a=blobdiff_plain;f=swank.R;h=1dc95b48800c305489292bc95f4cdb92f381e16e;hp=bd7e093703fa4a4d5f9fc5ea7e1ad986853ad7fa;hb=c15f7575dad3773f1f56e37f5943d8d277f76ee8;hpb=e35149b43e4da28f542c6bdf2decd802e84dd440 diff --git a/swank.R b/swank.R index bd7e093..1dc95b4 100644 --- a/swank.R +++ b/swank.R @@ -349,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) } @@ -419,3 +418,28 @@ computeRestartsForEmacs <- function (sldbState) { finally={sink(); output <- readLines(f); close(f)}) list(output, printToString(value)) } + +`swank:find-definitions-for-emacs` <- function(slimeConnection, sldbState, string) { + if(exists(string, envir = globalenv())) { + thing <- get(string, envir = globalenv()) + if(inherits(thing, "function")) { + body <- body(thing) + srcref <- attr(body, "srcref") + srcfile <- attr(body, "srcfile") + if(is.null(srcfile)) { + list() + } else { + filename <- get("filename", srcfile) + list(list(sprintf("function %s", string), + list(quote(`:location`), + list(quote(`:file`), sprintf("%s/%s", srcfile$wd, srcfile$filename)), + list(quote(`:line`), srcref[[2]][[1]], srcref[[2]][[2]]-1), + list()))) + } + } else { + list() + } + } else { + list() + } +}