Using the TAGS facility in Emacs for R/S functions

Tim Hesterberg x319 timh at
Mon Jan 28 18:24:39 CET 2002

>The Lubinsky-S-tags should be removed and users should be pointed to
>either ctags or some other tags program.  ctags is better than other
>tags programs ...
>Note, ctags can only support splus definitions that are on a single
>line.  It can not currently handle multiple line definitions like
>foofoo <-
>## The foofoo function ...
>function ( ... )

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/

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
# Script file to update TAGS files.
# Using source from resamp/[funs/help/src]
# Start in the root directory
# Once the tags files are created, use emacs find-tags (M-.) command.
# To select a new tags file, use visit-tags-table and select-tags-table

rm funsTAGS helpTAGS srcTAGS
touch funsTAGS helpTAGS srcTAGS

# funs
foreach d (resamp)
	/usr/bin/etags -a -o funsTAGS --regex=@updateTAGSregexp $d/funs/*.q $d/funs/*.qpp
# 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

# src
foreach d (resamp)
	etags -a -o srcTAGS $d/src/*.c $d/src/*.f $d/src/*.r $d/src/*.h

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
ess-help mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: ess-help-request at

More information about the ESS-help mailing list