erlang.el

Erlang mode for Emacs

Possibly the most important feature of an editor designed for programmers is the ability to indent a line of code in accordance with the structure of the programming language. The Erlang mode does, of course, provide this feature. The layout used is based on the common use of the language. The mode also provides things as syntax highlighting, electric commands, module name verification, comment support including paragraph filling, skeletons, tags support etc.

In the following descriptions the use of the word Point means: "Point can be seen as the position of the cursor. More precisely, the point is the position between two characters while the cursor is drawn over the character following the point".

Indent

The following command are directly available for indentation.

Lines containing comment are indented differently depending on the number of %-characters used:

Edit - Fill Comment

When editing normal text in text mode you can let Emacs reformat the text by the fill-paragraph command. This command will not work for comments since it will treat the comment characters as words.

The Erlang editing mode provides a command that knows about the Erlang comment structure and can be used to fill text paragraphs in comments. Ex:

      %% This is   just a very simple test to show
      %% how the Erlang fill
      %% paragraph   command works.

Clearly, the text is badly formatted. Instead of formatting this paragraph line by line, let's try erlang-fill-paragraph by pressing M-q. The result is:

      %% This is just a very simple test to show how the Erlang fill
      %% paragraph command works.

Edit - Comment/Uncomment Region

C-c C-c will put comment characters at the beginning of all lines in a marked region. If you want to have two comment characters instead of one you can do C-u 2 C-c C-c

C-c C-u will undo a comment-region command.

Edit - Moving the marker

Edit - Marking

Edit - Function Header Commands

Edit - Arrows

Syntax highlighting

The syntax highlighting can be activated from the Erlang menu. There are four different alternatives:

Tags

For the tag commands to work it requires that you have generated a tag file. See Erlang mode users guide

Skeletons

A skeleton is a piece of pre-written code that can be inserted into the buffer. Erlang mode comes with a set of predefined skeletons. The skeletons can be accessed either from the Erlang menu of from commands named tempo-template-erlang-*, as the skeletons is defined using the standard Emacs package "tempo". Here follows a brief description of the available skeletons:

Shell

Compile

Man

On unix you can view the manual pages in emacs. In order to find the manual pages, the variable `erlang-root-dir' should be bound to the name of the directory containing the Erlang installation. The name should not include the final slash. Practically, you should add a line on the following form to your ~/.emacs,

      (setq erlang-root-dir "/the/erlang/root/dir/goes/here")

Starting IMenu

Version