[ESS] Automatic jump to error line in the source code.

Christophe Rhodes csr21 at cantab.net
Tue Aug 31 12:08:15 CEST 2010


Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk> writes:

>> backtraces.  (I couldn't actually work out how to get the source
>> location from a name or a function object from R code -- I'd be
>> delighted if someone can tell me how)
>
> [...]
> If I load a function (e.g. 'apple') from a file, then I can see the
> source code stored as an attribute, but not the actual file or line
> numbers:
>
>> attributes(apple)
> $source
> [1] "function(x, y, z) {"        "  ## simple test function."
> [3] "  browser()"                "  x + y + z"               
> [5] "}"                         

I got an answer from Duncan Murdoch on r-devel regarding this: the
srcfile (and srcref) are stored in attributes on body() of the function,
rather than the function itself.  (This should be enough to support a
simple implementation of M-.).  Also in that message, Duncan said that
source-related attributes for packages depend on the "keep.source.pkgs"
option.

Christophe



More information about the ESS-help mailing list