28Chapter2 • Working With Editors
name as it can and will display the matching functions in a new buffer. If, for example, you
wanted to edit the
close_files
function, Figure 2-3 shows the results of typing
ESC .
c
.
If Emacs finds a function that matches your search string, it will replace the current buffer
with the contents of the first file in which it found the search string and the pointer will be posi-
tioned at the first line of that function. In the above example, completing the file name and press-
ing
ENTER
results in the file
exit.c
being opened and the pointer being positioned on the first
line of the
close_files
function. This is shown in Figure 2-4.
Alternatively, you can initiate the search with the command
ESC x find-tag-
other-window
and rather than replacing the current buffer with the found function, a new
buffer will be opened instead. Remember that Emacs has a completion function, so after typing
the first few characters of a function, you can press the
TAB
key and Emacs will fill in the rest
of the command if it is unique. If you are sure that a command is unique, pressing the
ENTER
key will execute that command.
Rather than searching for functions by name, you can also search all of the files referenced
in the tags file for a regular expression. To accomplish this, type
ESC x tags-search
and
Emacs will prompt you for a regular expression to search for. If it finds a match, the first occur-
rence of the string found will be displayed in the current buffer. You can search for the next
occurrence of the string by issuing the
ESC ,
command.
Figure2-3 Emacs tags-search function.
Next Page >>
<< Previous Page
Back to the Table of Contents