X-Git-Url: http://christophe.rhodes.io/gitweb/?p=swankr.git;a=blobdiff_plain;f=swank.R;h=71d502ecc03039de80f2de99401c8003d98cb963;hp=a9b62c6737994c8184a0961f07d29d3d8f8717c2;hb=99505873e6e7409fdfdf0852b84e111b7994414b;hpb=e64beb72d7b60d390ab8e2c0f6029dfede60877d diff --git a/swank.R b/swank.R index a9b62c6..71d502e 100644 --- a/swank.R +++ b/swank.R @@ -75,11 +75,19 @@ debuggerInfoForEmacs <- function(sldbState, from=0, to=NULL) { calls <- lapply(calls[from:to], { frameNumber <- from-1; function (x) { ret <- list(frameNumber, paste(format(x), sep="", collapse=" ")); frameNumber <<- 1+frameNumber; ret }}) } + computeRestartsForEmacs <- function () { + lapply(computeRestarts(sldbState$condition), + function(x) { + ## this is all a little bit internalsy + restartName <- x[[1]][[1]] + description <- restartDescription(x) + list(restartName, if(is.null(description)) restartName else description) + }) + } list(list(as.character(sldbState$condition), sprintf(" [%s]", class(sldbState$condition)[[1]]), FALSE), - lapply(computeRestarts(), function(x) list(x[[1]][[1]], x[[1]][[1]])), + computeRestartsForEmacs(), backtraceForEmacs(), list(sldbState$id)) -# lapply(calls[from:to], function(x) paste(format(x), sep="", collapse=" "))) } readPacket <- function(io) { @@ -253,3 +261,9 @@ writeSexpToString <- function(obj) { `swank:debugger-info-for-emacs` <- function(io, sldbState, from, to) { debuggerInfoForEmacs(sldbState, from=from, to=to) } + +`swank:invoke-nth-restart-for-emacs` <- function(io, sldbState, level, n) { + if(sldbState$level == level) { + invokeRestart(computeRestarts()[[n+1]]) + } +}