Using the TAGS facility in Emacs for R/S functions

Tim Hesterberg x319 timh at insightful.com
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/
/"[[]+\(<-\)*[.][.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
# 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
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
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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