Using the TAGS facility in Emacs for R/S functions

Jeff Mincy jeff at delphioutpost.com
Thu Jan 31 16:36:39 CET 2002


On Mon, 28 Jan 2002, timh at insightful.com wrote:

> In case it helps, here's what I'm using to generate tags.
> I believe this supports both quoted and unquoted names, defined with
> _ or <-, on one or more lines.  It only picks up definitions that
> start at the beginning of a line; so objects or functions defined
> inside functions, and indented, are not found.

 
> I save the following to a file "updateTAGSregexp":
> --------------------------------------------------
> /This is a file of regular expressions to be used by updateTAGS/
> /First normal names, no subscripting or assignment form/
> /Use grouping to get just the name/
> /"*\([.A-Za-z][.A-Za-z0-9]*\)"*[ \t]*\(<-\|_\)/\1/
> /Now the subscripting versions, must be quoted/
> /"[[]+\(<-\)*[.][.A-Za-z][.A-Za-z0-9]*"/
> --------------------------------------------------
> 
> Then call the following shell script, to extract tags for
> S functions, help files, and C and Fortran source
> (from particular subdirectories of the current directory):
> --------------------------------------------------
> #! /bin/csh
>  ....
> # funs
> foreach d (resamp)
> 	/usr/bin/etags -a -o funsTAGS --regex=@updateTAGSregexp
> 	$d/funs/*.q $d/funs/*.qpp
> end
> # foreach d (support tilting resample)  -- how I did it before

> # help
> foreach d (resamp)
> 	/usr/bin/etags -a -o helpTAGS --regex='/.FN[
> 	\t]*[[.A-Za-z0-9]*/' $d/help/*.d
> end
> 
> # src
> foreach d (resamp)
> 	etags -a -o srcTAGS $d/src/*.c $d/src/*.f $d/src/*.r
> 	$d/src/*.h
> end
> 
> cat funsTAGS helpTAGS srcTAGS > TAGS
> 
> # Make a version of the TAGS file in the resamp directory; change
> # resamp/* to *
> rm resamp/TAGS
> sed s:resamp/:: TAGS > resamp/TAGS


> Tim Hesterberg


Just out of curiosity, what version of etags are you using?  It looks
like you've got an older version.  I'm using the following:
   Exuberant Ctags 5.0.1, Copyright (C) 1996-2001 Darren Hiebert
     Addresses: <darren at hiebert.com>, http://ctags.sourceforge.net
     Optional compiled features: +wildcards, +regex


Anyway, your message gave some ideas.


I have the following tags config file:

/etc/ctags.conf
  ================
  --verbose=yes
  --totals=yes
  --recurse
  --langmap=asm:
  --langdef=Splus
  --langmap=Splus:.s.S.R.r.q
  --regex-Splus=/^[ \t]+"?([.A-Za-z][.A-Za-z0-9]*)"?[ \t]*(<-|_)[ \t]*function/\1/
  --regex-Splus=/^"?([.A-Za-z][.A-Za-z0-9]*)"?[ \t]*(<-|_)/\1/
  ================

Basically, I tell etags that Splus is a language that has two regex.
Any assignment starting at the beginning of a line
is picked up.   Also, nested function definitions will get picked
up, as long as 'function' is on the same line.

Then I create a file .ctags-exclude contains things like 'data' that I
don't want etags to recurse into.

And then I do:

   etags -f S_TAGS --exclude=@.ctags-exclude

-jeff
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
ess-help mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: ess-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the ESS-help mailing list