From a2977df7dc0b477dfb5adedc2c9d1c32cec83e15 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Thu, 9 Sep 2010 23:28:11 +0100 Subject: [PATCH] slightly more working inspector Use an environment for istate rather than a list implement swank:inspector-nth-part and swank:inspect-nth-part --- swank.R | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/swank.R b/swank.R index cb13210..ff22caa 100644 --- a/swank.R +++ b/swank.R @@ -475,9 +475,12 @@ resetInspector <- function(slimeConnection) { } inspectObject <- function(slimeConnection, object) { - slimeConnection$istate <- list(object=object, previous=slimeConnection$istate) + previous <- slimeConnection$istate + slimeConnection$istate <- new.env() + slimeConnection$istate$object <- object + slimeConnection$istate$previous <- previous slimeConnection$istate$content <- emacsInspect(object) - if(!object %in% slimeConnection$inspectorHistory) { + if(!(object %in% slimeConnection$inspectorHistory)) { slimeConnection$inspectorHistory <- c(slimeConnection$inspectorHistory, object) } if(!is.null(slimeConnection$istate$previous)) { @@ -516,7 +519,7 @@ prepareRange <- function(istate, start, end) { assignIndexInParts <- function(object, istate) { ret <- 1+length(istate$parts) - istate$parts <- c(istate$parts, object) + istate$parts <- c(istate$parts, list(object)) ret } @@ -536,7 +539,22 @@ emacsInspect.list <- function(list) { names(list), list)) } +emacsInspect.numeric <- function(numeric) { + c(list("a numeric", list(quote(`:newline`))), + mapply(function(name, value) { list(list(quote(`:line`), name, value)) }, + (1:length(numeric)), numeric)) +} + `swank:quit-inspector` <- function(slimeConnection, sldbState) { resetInspector(slimeConnection) FALSE } + +`swank:inspector-nth-part` <- function(slimeConnection, sldbState, index) { + slimeConnection$istate$parts[[index]] +} + +`swank:inspect-nth-part` <- function(slimeConnection, sldbState, index) { + object <- `swank:inspector-nth-part`(slimeConnection, sldbState, index) + inspectObject(slimeConnection, object) +} -- 2.39.5