---
name: "tags"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/tags/3erl"
---

# tags(3erl)

Generate Emacs TAGS file from Erlang source files

## NAME

tags - Generate Emacs TAGS file from Erlang source files

## DESCRIPTION

A *TAGS* file is used by Emacs to find function and variable definitions in any source file in large projects. This module can generate a *TAGS* file from Erlang source files. It recognises functions, records, and macro definitions.

## EXPORTS

```
file(File) -> ok | error
```

```
file(File, Options) -> ok | error
```

Types:

File = file:filename()\
 Options = \[option()\]\

```
option() =
    {outfile, NameOfTAGSFile :: file:filename()} |
    {outdir, NameOfDirectory :: file:filename()}
```

Create a *TAGS* file for the file *File*.

```
files(FileList) -> ok | error
```

```
files(FileList, Options) -> ok | error
```

Types:

FileList = \[file:filename()\]\
 Options = \[option()\]\

```
option() =
    {outfile, NameOfTAGSFile :: file:filename()} |
    {outdir, NameOfDirectory :: file:filename()}
```

Create a TAGS file for the files in the list *FileList*.

```
dir(Dir) -> ok | error
```

```
dir(Dir, Options) -> ok | error
```

Types:

Dir = file:filename()\
 Options = \[option()\]\

```
option() =
    {outfile, NameOfTAGSFile :: file:filename()} |
    {outdir, NameOfDirectory :: file:filename()}
```

Create a TAGS file for all files in directory *Dir*.

```
dirs(DirList) -> ok | error
```

```
dirs(DirList, Options) -> ok | error
```

Types:

DirList = \[file:filename()\]\
 Options = \[option()\]\

```
option() =
    {outfile, NameOfTAGSFile :: file:filename()} |
    {outdir, NameOfDirectory :: file:filename()}
```

Create a TAGS file for all files in any directory in *DirList*.

```
subdir(Dir) -> ok | error
```

```
subdir(Dir, Options) -> ok | error
```

Types:

Dir = file:filename()\
 Options = \[option()\]\

```
option() =
    {outfile, NameOfTAGSFile :: file:filename()} |
    {outdir, NameOfDirectory :: file:filename()}
```

Descend recursively down the directory *Dir* and create a *TAGS* file based on all files found.

```
subdirs(DirList) -> ok | error
```

```
subdirs(DirList, Options) -> ok | error
```

Types:

DirList = \[file:filename()\]\
 Options = \[option()\]\

```
option() =
    {outfile, NameOfTAGSFile :: file:filename()} |
    {outdir, NameOfDirectory :: file:filename()}
```

Descend recursively down all the directories in *DirList* and create a *TAGS* file based on all files found.

```
root() -> ok | error
```

```
root(Options) -> ok | error
```

Types:

Options = \[option()\]\

```
option() =
    {outfile, NameOfTAGSFile :: file:filename()} |
    {outdir, NameOfDirectory :: file:filename()}
```

Create a *TAGS* file covering all files in the Erlang distribution.

## OPTIONS

The functions above have an optional argument, *Options*. It is a list which can contain the following elements:

- \*

  *{outfile, NameOfTAGSFile}* Create a *TAGS* file named *NameOfTAGSFile*.

- \*

  *{outdir, NameOfDirectory}* Create a file named *TAGS* in the directory *NameOfDirectory*.

The default behaviour is to create a file named *TAGS* in the current directory.

## EXAMPLES

- \*

  *tags:root(\[{outfile, "root.TAGS"}\]).* \

  This command will create a file named *root.TAGS* in the current directory. The file will contain references to all Erlang source files in the Erlang distribution.

- \*

  *tags:files(\["foo.erl", "bar.erl", "baz.erl"\], \[{outdir, "../projectdir"}\]).*  \

  Here we create file named *TAGS* placed it in the directory *../projectdir*. The file contains information about the functions, records, and macro definitions of the three files.

## SEE ALSO

- \*

  Richard M. Stallman. GNU Emacs Manual, chapter "Editing Programs", section "Tag Tables". Free Software Foundation, 1995.

- \*

  Anders Lindgren. The Erlang editing mode for Emacs. Ericsson, 1998.
