When I do rtags(ofile="TAGS") at the R prompt, the "TAGS" file is written and there is no output to the terminal (exactly as expected).
When I do R CMD rtags -o TAGS at the shell prompt, the "TAGS" file is written too, but I see several sets of messages on the terminal like this:
etags: no input files specified.
Try `etags --help' for a complete list of options.
I see 6 sets - 12 lines - when I move my libPath out of the current directory and two sets - 4 lines - when I keep it there. I.e., I see more warnings when rtags processes fewer files.
To reproduce, run in an empty directory:
$ mkdir z
$ cd z
$ R --vanilla CMD rtags
Tagging R/C/Rd files under /home/sds/z; writing to TAGS (overwriting)...
etags: no input files specified.
Try `etags --help' for a complete list of options.
etags: no input files specified.
Try `etags --help' for a complete list of options.
etags: no input files specified.
Try `etags --help' for a complete list of options.
etags: no input files specified.
Try `etags --help' for a complete list of options.
etags: no input files specified.
Try `etags --help' for a complete list of options.
etags: no input files specified.
Try `etags --help' for a complete list of options.
Done
What causes these warnings? Is there a way to avoid them?
The command
R CMD rtagscreate a TAGS file for 3 different types of files: R files, C files and Rd files (documentation for R files). For R files it uses the R functionutils::rtags()and for C and Rd files it calls theetagsutility (on Linux; not sure what it does on MacOS or Windows).The error messages that you see are emitted by
etagswhen it is called without any input file. This happens becauseR CMD rtagsusesfindto look for files to process byetagsand feeds the output offindintoetags. If there are no C or Rd files in the directory you are processing or in any sub-directory of it,etagswould be called with an empty list of files to process, which will cause it to print an error message.You see several error messages because there are separate calls to
etagsfor Rd files and 'C files', which actually inclueds .c, .h, .cpp and several other types.In order to suppress these messages you should explicitly tell
R CMD rtagsnot to process files you don't have. For example,R CMD rtags --no-cwill not try to look for C files, andR CMD rtags --no-Rdwill not try to look for Rd files.So if, for example, you are interested in tagging only R files, use
R CMD rtags --no-c --no-Rd. SeeR CMD rtags --helpfor more details.As a side note, if you have C files in your project and you do want to tag them along with R files, you might still get such error messages - say that you have *.c and *.h files but no *.cpp files, and you call
R CMD rtagswithout the--no-cflag. The command will also look for *.cpp files and calletagswith an empty list.Another note that worth mentioning here, although not directly related to the question, is that
R CMD rtagslook only for *.R files that are directly under a directory namedR. So R files in a directory with a different name would not be tagged. If you need to tag R files that are in such directories, or if you need more flexibility, you can callutils::rtags()from an R session with suitable arguments.