[Geany-devel] R Tags

Jonathan Daily biomathjdaily at xxxxx
Mon Nov 15 13:54:10 UTC 2010


If you need rtags() in R to give you an output, I use:

rtags(path = "/path/to/R/library/base", recursive = T, ofile =
 "/home/whatever.tags")



On Thu, Nov 11, 2010 at 4:45 PM, Lex Trotman <elextr at gmail.com> wrote:

> On 12 November 2010 02:32, Nick Treleaven <nick.treleaven at btinternet.com>
> wrote:
> > On Thu, 11 Nov 2010 09:11:30 +1100
> > Lex Trotman <elextr at gmail.com> wrote:
> >
> >> > However, even if geany -g worked on .R files, the approach would be
> >> > difficult to apply in practice. It requires the user to specify .R
> >> > files, and given the structure of R packages this could be a quickly
> >> > become tedious. It would have been much easier if Geany accepted a
> >> > path in which it could recursively scan (and parse) R files. The
> >> > rtags() function can do that, so it might make sense to find a
> >> > conversion route for etags files.
> >> >
> >>
> >> Whats the structure of R packages?
> >>
> >> Presuming from the above that it is lot of files in nested directories
> >> you could use find to run geany -g on them all.  Whilst that gives you
> >> lots of tag files to open, I don't expect it to be too much slower
> >> than one huge file.
> >>
> >> Otherwise patches are welcome.
> >
> > I'm not sure that reimplementing Unix find is something Geany should be
> > doing really. But documenting how to do that in the manual would
> > be a good idea.
> >
> > Supporting CTags format is something on the TODO list.
> >
> > You can 'see' the format in tagmanager/tm_tag.c in the tm_tag_write()
> > function. That is just called repeatedly for each tag entry in the file.
>
> Bah missed it :-)
>
> The R source reveals
>
> write.etags <-
>    function(src,
>             tokens, startlines, lines, nchars,
>             ...,
>             shorten.lines = c("token", "simple", "none"))
> {
>    ## extra 1 for newline
>    shorten.lines <- match.arg(shorten.lines)
>    offsets <- (cumsum(nchars + 1L) - (nchars + 1L))[startlines]
>    lines <-
>        switch(shorten.lines,
>               none = lines,
>               simple = sapply(strsplit(lines, "function", fixed =
> TRUE), "[", 1),
>               token = mapply(shorten.to.string, lines, tokens))
>    tag.lines <-
>        paste(sprintf("%s\x7f%s\x01%d,%d",
>                      lines, tokens, startlines,
>                      as.integer(offsets)),
>              collapse = "\n")
>    ## simpler format: tag.lines <- paste(sprintf("%s\x7f%d,%d",
> lines, startlines, as.integer(offsets)), collapse = "\n")
>    tagsize <- nchar(tag.lines, type = "bytes") + 1L
>    cat("\x0c\n", src, ",", tagsize, "\n", tag.lines, "\n", sep = "", ...)
> }
>
> So someone who reads C and R can write a converter :-)
>
> Cheers
> Lex
>
> >
> > Nick
> > _______________________________________________
> > Geany-devel mailing list
> > Geany-devel at uvena.de
> > http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
> >
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20101115/123a810c/attachment.html>


More information about the Devel mailing list