Christophe Weblog Wiki Code Publications Music
implement swank:frame-source-location
[swankr.git] / swank.R
diff --git a/swank.R b/swank.R
index 0684ab071366fca918bd5541c5aa2ed6e76f5b46..f395217bf92abe79767a55c5434bc015bb003781 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -284,6 +284,21 @@ computeRestartsForEmacs <- function (sldbState) {
   }
 }
 
+`swank:frame-source-location` <- function(io, sldbState, n) {
+  call <- sldbState$calls[[n+1]]
+  srcref <- attr(call, "srcref")
+  srcfile <- attr(srcref, "srcfile")
+  if(is.null(srcfile)) {
+    list(quote(`:error`), "no srcfile")
+  } else {
+    filename <- get("filename", srcfile)
+    list(quote(`:location`),
+         list(quote(`:file`), filename),
+         list(quote(`:line`), srcref[[1]], srcref[[2]]-1),
+         FALSE)
+  }
+}
+
 `swank:buffer-first-change` <- function(io, sldbState, filename) {
   FALSE
 }