]> rhodes.io Git - swankr.git/commitdiff
Christophe Weblog Wiki Code Publications Music
implement swank:compile-string-for-emacs
authorChristophe Rhodes <csr21@cantab.net>
Tue, 24 Aug 2010 17:06:48 +0000 (18:06 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Tue, 24 Aug 2010 17:06:48 +0000 (18:06 +0100)
As long as my defun-prompt-regexp is set up right, I can now use C-c
C-c to develop swankr.  Go me.

swank.R

diff --git a/swank.R b/swank.R
index ddd1a0e5b64df12104370a3851e55cf3e9981379..1c1633d77ad8c7aa7fa8a709eb3a3bcd02e57e10 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -310,3 +310,11 @@ printToString <- function(val) {
     list(as.list(matches), longest)
   }
 }
+
+`swank:compile-string-for-emacs` <- function(io, sldbState, string, buffer, position, filename, policy) {
+  # FIXME: I think in parse() here we can use srcref to associate
+  # buffer/filename/position to the objects.  Or something.
+  withRestarts({ times <- system.time(eval(parse(text=string), envir = globalenv())) },
+               abort="abort compilation")
+  list(quote(`:compilation-result`), list(), TRUE, times[3])
+}