From 22705b4ae5466d59d3312a1cda4c0cb5e1ca52ea Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Thu, 29 Nov 2012 14:50:08 +0000 Subject: [PATCH] more srcref frobbing I do not pretend to understand whether this is new, but in 2.14 parsing an expression, in addition to adding srcref attributes to the results of the parse, can result in actual srcref elements being in the results. Those srcrefs also need to be frobbed so that display of functions at the repl works properly. (I do think this worked in 2.12 without this extra frobbing, but I am totally prepared to admit that I can't really remember). Since we're on the case, also frob things that look like srcrefs but aren't under "srcref" attributes, such as "wholeSrcref"s --- swank.R | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/swank.R b/swank.R index 757e243..8ba9060 100644 --- a/swank.R +++ b/swank.R @@ -525,6 +525,12 @@ computeRestartsForEmacs <- function (sldbState) { if(mode(s) == "name") { return(s) } + if(is(s, "srcref")) { + ## more monumental KLUDGE: parsing (in 2.14, at least) appears + ## to put srcrefs directly in `length 2' objects, which we need + ## to frob directly. + return(frob(list(s))[[1]]) + } srcrefs <- attr(s, "srcref") attribs <- attributes(s) new <- @@ -536,6 +542,9 @@ computeRestartsForEmacs <- function (sldbState) { if(!is.null(attr(s, "srcref"))) { attr(new, "srcref") <- frob(srcrefs) } + if(!is.null(attr(s, "wholeSrcref"))) { + attr(new, "wholeSrcref") <- frob(list(attr(s, "wholeSrcref")))[[1]] + } new } withRestarts({ -- 2.39.5