1 presentationCounter <- 0
3 savePresentedObject <- function(slimeConnection, value) {
4 if(!exists("idToObject", envir=slimeConnection)) {
5 assign("idToObject", new.env(), envir=slimeConnection)
7 presentationCounter <<- presentationCounter + 1
8 assign(as.character(presentationCounter), value, envir=slimeConnection$idToObject)
12 presentReplResult <- function(slimeConnection, value) {
13 id <- savePresentedObject(slimeConnection, value)
14 sendToEmacs(slimeConnection,
15 list(quote(`:presentation-start`), id, quote(`:repl-result`)))
16 sendReplResult(slimeConnection, value)
17 sendToEmacs(slimeConnection,
18 list(quote(`:presentation-end`), id, quote(`:repl-result`)))
19 sendToEmacs(slimeConnection,
20 list(quote(`:write-string`), "\n", quote(`:repl-result`)))
23 sendReplResultFunction <- presentReplResult
25 `cl:nth-value` <- function(slimeConnection, sldbState, n, values) {
29 `swank:lookup-presented-object` <- function(slimeConnection, sldbState, id) {
30 str(ls(slimeConnection))
31 if(exists(as.character(id), envir=slimeConnection$idToObject)) {
32 value <- get(as.character(id), envir=slimeConnection$idToObject)
39 `swank:lookup-presented-object-or-lose` <- function(slimeConnection, sldbState, id) {
40 stuff <- `swank:lookup-presented-object`(slimeConnection, sldbState, id)
44 stop(sprintf("attempt to access unrecorded object (id %d)", id))
48 `swank:clear-repl-results` <- function(slimeConnection, sldbState) {
49 if(!exists("idToObject", envir=slimeConnection)) {
50 assign("idToObject", new.env(), envir=slimeConnection)
52 rm(list=ls(slimeConnection$idToObject), envir=slimeConnection$idToObject)