I found this function in this site:
(defun search-selection (beg end)
"search for selected text"
(interactive "r")
(let ((selection (buffer-substring-no-properties beg end)))
(deactivate-mark)
(isearch-mode t nil nil nil)
(isearch-yank-string selection)))
(define-key global-map (kbd "<C-f3>") 'search-selection)
With this, I just need to select the text and hit C-f3
, and Isearch finds the string from the current cursor point to the rest of the buffer. But when it reaches the bottom the function doesn't wrap around to search from the beginning of the buffer.
How can I make this function wrap around?
C-s
to repeat the search?