Node:Finding More, Next:, Previous:Buffer Walk Through, Up:Buffer Walk Through



4.1 Finding More Information

In this walk-through, I will describe each new function as we come to it, sometimes in detail and sometimes briefly. If you are interested, you can get the full documentation of any Emacs Lisp function at any time by typing C-h f and then the name of the function (and then <RET>). Similarly, you can get the full documentation for a variable by typing C-h v and then the name of the variable (and then <RET>).

In versions 20 and higher, when a function is written in Emacs Lisp, describe-function will also tell you the location of the function definition. If you move point over the file name and press the <RET> key, which is this case means help-follow rather than `return' or `enter', Emacs will take you directly to the function definition.

More generally, if you want to see a function in its original source file, you can use the find-tags function to jump to it. find-tags works with a wide variety of languages, not just Lisp, and C, and it works with non-programming text as well. For example, find-tags will jump to the various nodes in the Texinfo source file of this document.

The find-tags function depends on `tags tables' that record the locations of the functions, variables, and other items to which find-tags jumps.

To use the find-tags command, type M-. (i.e., type the <META> key and the period key at the same time, or else type the <ESC> key and then type the period key), and then, at the prompt, type in the name of the function whose source code you want to see, such as mark-whole-buffer, and then type <RET>. Emacs will switch buffers and display the source code for the function on your screen. To switch back to your current buffer, type C-x b <RET>. (On some keyboards, the <META> key is labelled <ALT>.)

Depending on how the initial default values of your copy of Emacs are set, you may also need to specify the location of your `tags table', which is a file called TAGS. For example, if you are interested in Emacs sources, the tags table you will most likely want, if it has already been created for you, will be in a subdirectory of the /usr/local/share/emacs/ directory; thus you would use the M-x visit-tags-table command and specify a pathname such as /usr/local/share/emacs/21.0.100/lisp/TAGS or /usr/local/src/emacs/lisp/TAGS. If the tags table has not already been created, you will have to create it yourself.

To create a TAGS file in a specific directory, switch to that directory in Emacs using M-x cd command, or list the directory with C-x d (dired). Then run the compile command, with etags *.el as the command to execute

M-x compile RET etags *.el RET

For more information, see Create Your Own TAGS File.

After you become more familiar with Emacs Lisp, you will find that you will frequently use find-tags to navigate your way around source code; and you will create your own TAGS tables.

Incidentally, the files that contain Lisp code are conventionally called libraries. The metaphor is derived from that of a specialized library, such as a law library or an engineering library, rather than a general library. Each library, or file, contains functions that relate to a particular topic or activity, such as abbrev.el for handling abbreviations and other typing shortcuts, and help.el for on-line help. (Sometimes several libraries provide code for a single activity, as the various rmail... files provide code for reading electronic mail.) In The GNU Emacs Manual, you will see sentences such as "The C-h p command lets you search the standard Emacs Lisp libraries by topic keywords."