[ESS] TAGS only the first function in some files
Stephen Eglen
S.J.Eglen at damtp.cam.ac.uk
Thu Dec 2 17:06:36 CET 2004
Henrik Andersson writes:
> I tried to use etags to tag my R files.
>
> For some files it indexes all functions but for some files it only finds
> the first function defined and skips the rest???
>
> I ran 'etags *.R' in the folder containing my scripts, did I miss
> something vital?
>
Dear Henkrik, et al.
It looks to me like etags does not have support built-in for R code;
the fact that it worked at all for some of your scripts is probably
coincidence with support for other languages, rather than design!
Instead, I believe the solution to using etags is along the following
lines:
etags --language=none
--regex='/\([^ \t]+\)[ \t]*<-[ \t]*function/\1/' *.R
(I've broken the line manually before --regex, but that should all go
on one line.)
I.e. we need to describe a regex for the first line of the function;
here the regex is:
some.name <- function
note: function name is in column 0 (but adding whitespace regex should
not be hard)
whitespace _before_ assignment (<-) is necessary; that can be removed
I guess by including < as one of the characters to skip in the first
part of the regex; space after the assignment is optional.
Please test and report back; if this works out, we can add it to the
manual at least. If it proves very useful for several ess-users, I
can see if we can get the regexp added to Emacs.
Stephen
More information about the ESS-help
mailing list