[ESS] TAGS only the first function in some files

Andersson, Henrik H.Andersson at nioo.knaw.nl
Fri Dec 3 09:23:14 CET 2004


Thanks a lot Stephen,

Tested it and after changing single quotes (') to double (") around the
regexp it worked in Win XP cmd shell.

Cheers, Henrik

> -----Original Message-----
> From: Stephen Eglen [mailto:S.J.Eglen at damtp.cam.ac.uk]
> Sent: Thursday, December 02, 2004 5:07 PM
> To: Andersson, Henrik
> Cc: ess-help at stat.math.ethz.ch
> Subject: [ESS] TAGS only the first function in some files
> 
> 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