There are some easy ways to improve the Erlang mode for Emacs. They are actually included in the Erlang mode already, just not turned on by default.
To be able to search a little more efficiently than the standard
Ctrl+S command, you can utilize the Emacs concept of tags. From the Erlang manual:
Tags is a standard Emacs package used to record information about source files in large development projects. In addition to listing the files of a project, a tags file normally contains information about all functions and variables that are defined. By far, the most useful command of the tags system is its ability to find the definition of functions in any file in the project.
To create tags for your project just enter a directory and use the
etags command (included with Emacs) on the Erlang files you want to create tags for:
$ etags *.erl *.hrl $
This creates a file named
TAGS in the current directory. Whenever you load a file in Emacs in that directory the
TAGS file is used to search for tags for all the files you included when creating it.
To search for a tag (which is mostly equivalent to function names) just press
M+. (thats the Meta key, usually located on the Alt key). Then type in your search term (you can auto complete with Tab) and Emacs will jump to the tag in the file it is located. If the file is not opened by Emacs, it is automatically opened.
Another cool feature of the Erlang mode is the “functions” menu. If you type the command
M+x imenu-add-to-menubar, and then enter a name for the menu, you will get a menu which contains all the functions in the current file. If you click them, Emacs will jump to the function definition.
Sadly, this is not done when the Erlang mode loads, but there is a simple way to make it so. In your .emacs file (for Xemacs it is the .xemacs/init.el file) enter the following rows:
(add-hook 'erlang-mode-hook 'my-erlang-hook-function) (defun my-erlang-hook-function () (imenu-add-to-menubar "Functions"))
This will automatically create a menu called “Functions” (you can rename it to your liking) whenever the Erlang mode is activated. In this hook you can also add other things that will be specific to the Erlang mode, and the Erlang mode only, in your Emacs.
I have tested these on XEmacs 21.5.25 and they should work on Emacs too, but I don’t guarantee it. If they don’t I’m happy to update with instructions on how to enable this on Emacs too.