Etags

The vi, emacs, and elle editors are installed in the prebuilt Minix virtual machine for VMware. It is a scaled down, but serviceable version of emacs, but doesn't support tag searches with etags. To use etags you will need to use the emacs editor. You can use the packman command to install emacs and this also will install the etags program.

Etags can be used to produce an index to functions, defines, global variables (and probably a bit more) in files you specify. The default name of the index file produced is 'TAGS' (all capitals; this distinguishes it from the default 'tags' file produced by ctags, which is for use with vi, vim, or the elvis editors).

The emacs editors can use the index file(s) produced by etags to search for a requested function name, defined name, or global variable, etc. Each of these search names are referred to as a tag. If the tag is found in the index, it will open the file containing the searched for tag in a new buffer. The current file being edited is still being edited, but in its own emacs buffer.

(For a guide to using emacs see the emacs tutorial.)

Emacs Note:

Most emacs commands are bound to key combinations using either the control key (e.g. control-x is indicated here by ^x). Some commands usthe the "meta" key (for example, meta-x is indicated here by M-x). But what is the "meta" key?

Note that M- refers to using the "meta" key together with some following key. Several emacs commands are invoked using the meta key. Which is the meta key. Try the Alt key. If that doesn't work, the Esc key will work as the meta key. However, There is a difference between the Alt and the Esc keys when used in combination with a second key.

For example, how do you enter M-x

 With Alt:   Hold the Alt key down and continue to press it while
	     pressing the x.

 With Esc:   Press and release the Esc key, then press x.
    

Finding tags:

The key combination M-. (meta-dot) will prompt for the tag name to search for.

After finding a tag with the M-. command, you can search for additional occurrences of the same tag by:

 ^u M-.    (ctrl-u (release) then M-.)
    

To search for a new tag name, just type M-. and enter the new tag.

Etags command

By default etags includes function names, global variables, defines.

Example:

In some directory( e.g. your home directory):

  $ etags  /usr/src/servers/pm/*.[ch] /usr/src/kernel/*.[chs]
    

This produces a file named 'TAGS' in the current directory.

More entries in the TAGS file can be added using the -a (for append) switch for etags. For example, we could add the declarations from the header files to the existing TAGS file by:

$ etags -a /usr/src/include/*.h /usr/src/include/minix/*.h
    

Here is a makefile named maketags (http://condor.depaul.edu/~glancast/443class/docs/maketags) with most all the Minix items added to a TAGS file.

BASE=/usr/src/

all:
	rm -f TAGS
	etags -a $(BASE)boot/*.[sch]
	etags -a $(BASE)include/*.h
	etags -a $(BASE)include/minix/*.h
	etags -a $(BASE)include/ibm/*.h 
	etags -a $(BASE)kernel/*.[csh]
	etags -a $(BASE)kernel/system/*.[csh]
	etags -a $(BASE)servers/fs/*.[csh]
	etags -a $(BASE)servers/pm/*.[csh]
	etags -a $(BASE)servers/init/*.[csh]
	etags -a $(BASE)lib/syslib/*.[csh] 
	etags -a $(BASE)lib/other/*.[csh]  
	etags -a $(BASE)lib/i386/rts/*.[csh]
	etags -a $(BASE)drivers/*.[csh]
	etags -a $(BASE)drivers/tty/*.[csh]
	etags -a $(BASE)drivers/libdriver/*.[csh]
	etags -a $(BASE)drivers/bios_wini/*.[csh]


    

To use it to produce a fairly complete TAGS file copy it into Minix and then type

  $ make -f maketags
    

(You shouldn't have to do this more than once. But if for some reason you happen to corrupt the TAGS file, it can be used to rebuild it.)

The -f option causes the make program to use the following file, mketags, instead of looking for the default names - makefile and Makefile.