Discussion:
isearch-whole-buffer?
(too old to reply)
xyblor
2006-03-24 15:10:25 UTC
Permalink
Is there a way to search the whole buffer while I type, like Firefox's
"find" command?

As it is now, C-s only searches the text after the point, and C-r
searches the text before the point. I think it would be more convenient
for me if C-s searched the whole text, without forcing me to press C-s
again to overwrap the search. Does anyone know of a function that would
accomplish this? Or maybe there's a variable I can change to get the
desired behavior? I'm using XEmacs 21.4.13 on Win32.

Thanks for any help!
bojohan+ (Johan Bockgård)
2006-03-26 01:02:23 UTC
Permalink
In Emacs 22 you could use something like:

(setq isearch-search-fun-function 'wrapping-search-fun)

(defun wrapping-search-fun ()
(lambda (&rest args)
(let* ((isearch-search-fun-function nil)
(fun (isearch-search-fun)))
(or (apply fun args)
(unless (cadr args)
(goto-char (if isearch-forward (point-min) (point-max)))
(apply fun args))))))


(It will wrap around silently without indicating "wrapped" or
"overwrapped" search.)
--
Johan Bockgård
Loading...