From: Christophe Rhodes Date: Tue, 24 Aug 2010 17:06:48 +0000 (+0100) Subject: implement swank:compile-string-for-emacs X-Git-Url: http://christophe.rhodes.io/gitweb/?a=commitdiff_plain;h=5035036a7da09e17a5a70ea7ea15657d671e9c52;p=swankr.git implement swank:compile-string-for-emacs As long as my defun-prompt-regexp is set up right, I can now use C-c C-c to develop swankr. Go me. --- diff --git a/swank.R b/swank.R index ddd1a0e..1c1633d 100644 --- 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]) +}