Using the TAGS facility in Emacs for R/S functions

Stephen Eglen eglen at pcg.wustl.edu
Sun Jan 27 04:06:59 CET 2002


Hi,

Whilst still on the topic of regular expressions for finding function
definitions... ESS distribution (v 5.1.19) currently has files in

  ess-5.1.19/etc/other/Tags/

explaining how to get the Emacs TAGS facility working for various
files.  In particular, there is the "Lubinksy-S-tags" directory
providing a etags.c to allow it to recognise S functions.  I guess
David Lubinsky modified etags.c in the days before it had the --regex
flag.  Recent versions of etags (distributed both with Emacs and
XEmacs) have that flag now, so I think the following Makefile sample
suffices to generate decent TAGS files for .R (and .S) files:

Stephen

.PHONY: TAGS
TAGS:	
	etags --language=none --regex='/\(.+\)[ \t]*<-[ \t]*function/' *.r 

## I think "function" must be on the same line as the function name:
##   go <- function(x, y, z)
## is okay, but the following won't get picked up:
##   go2 <- 
##     function(x, y, z)
## I think this is a limitation with etags.


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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