Reputation: 1877
Consider the following text file:
foo
bar
yoo
ploo
Imagine that I want to search the word foo
and that my cursor in in the third line. I use C-s
which calls isearch-forward
, then input foo
and press Enter
: the issue is that by default, my cursor stays at the same position, unless I press C-s
once again before pressing Enter
. Indeed, I would like isearch-forward
to move in the whole file, and not only the part of the file that is after the cursor. How could I do this ?
Upvotes: 2
Views: 908
Reputation: 466
Possible Duplicate:
Automatically wrapping I-search?
Try this: (copied from the link above)
(defadvice isearch-search (after isearch-no-fail activate)
(unless isearch-success
(ad-disable-advice 'isearch-search 'after 'isearch-no-fail)
(ad-activate 'isearch-search)
(isearch-repeat (if isearch-forward 'forward))
(ad-enable-advice 'isearch-search 'after 'isearch-no-fail)
(ad-activate 'isearch-search)))
Upvotes: 3