Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 8: Searching for Text in Multiple Files

Previous HourNext Hour

Sections in this Hour:

 

Q&A

Q The TAGS facility is only for programmers, not for people who use Emacs to write letters, HTML documents, or LaTeX files, right?

A Wrong! The TAGS facility is indeed very useful for programmers, but it is also a general search tool for multiple files. With grep you can get a list of all occurrences of specific text, but the TAGS facility is the optimal tool to jump from occurrence to occurrence. Furthermore, you need the TAGS facility to do search-and-replace in several files in one go. The alternative is to open the files one at a time, and to perform ordinary search-and-replace in each of them.

Q I still don't see what the difference between TAGS and igrep is; could you please make that clear to me?

A igrep shows you the lines that match in a separate buffer, whereas TAGS let you travel from match to match. TAGS offers search-and-replace, whereas igrep doesn't. When you use TAGS, you need to create a TAGS file that you don't need when using igrep.

Q When I use one of the grep commands, Emacs complains about not being able to find the grep command.

A You might not have the command installed. If you are using UNIX, you can find the grep package at ftp://SunSITE.doc.ic.ac.uk/gnu/. If you are using Windows, please refer the Windows Note in the section about grep. Another reason might be that you do not have the grep command in your search path. A common mistake is that you start Emacs from your window manager and that its search path is not set up correctly.

Q Can I set bookmarks in every kind of buffer?

A No. You can set bookmarks only in buffers that visit files. (Info files are included, because they are in fact just visiting files--in a smart way.) You can't set them in buffers that are generated by some command. As a rule of thumb, buffers that start and end with a star cannot have bookmarks set in them.

Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 8: Searching for Text in Multiple Files

Previous HourNext Hour

Sections in this Hour: