From 5035036a7da09e17a5a70ea7ea15657d671e9c52 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Tue, 24 Aug 2010 18:06:48 +0100 Subject: [PATCH] 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. --- swank.R | 8 ++++++++ 1 file changed, 8 insertions(+) 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]) +} -- 2.30.2