D.4.2 Using occur

Sometimes the texinfo-show-structure command produces too much information. Perhaps you want to remind yourself of the overall structure of a Texinfo file, and are overwhelmed by the detailed list produced by texinfo-show-structure. In this case, you can use the occur command directly. To do this, type:

M-x occur

and then, when prompted, type a regexp, a regular expression for the pattern you want to match. (See Regular Expressions in The GNU Emacs Manual.) The occur command works from the current location of the cursor in the buffer to the end of the buffer. If you want to run occur on the whole buffer, place the cursor at the beginning of the buffer.

For example, to see all the lines that contain the word ‘@chapter’ in them, just type ‘@chapter’. This will produce a list of the chapters. It will also list all the sentences with ‘@chapter’ in the middle of the line.

If you want to see only those lines that start with the word ‘@chapter’, type ‘^@chapter’ when prompted by occur. If you want to see all the lines that end with a word or phrase, end the last word with a ‘$’; for example, ‘catching mistakes$’. This can be helpful when you want to see all the nodes that are part of the same chapter or section and therefore have the same ‘Up’ pointer.

See Using Occur in The GNU Emacs Manual, for more information.