completion-search-distance

completion-search-distance is a variable defined in `completion.el'.
Its value is
15000


Documentation:
How far to search in the buffer when looking for completions.
In number of characters. If nil, search the whole buffer.

You can customize this variable.