]> rhodes.io Git - swankr.git/commitdiff
Christophe Weblog Wiki Code Publications Music
absolutify some more source file finding
authorChristophe Rhodes <csr21@cantab.net>
Wed, 6 Apr 2011 07:49:34 +0000 (08:49 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Wed, 6 Apr 2011 07:49:34 +0000 (08:49 +0100)
swank.R

diff --git a/swank.R b/swank.R
index 0384004ac87866fdf79bc4b99d072f954fde17ae..0de35f74997d9128489df019e7dec55251da00ce 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -304,8 +304,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 +372,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)
   }