On Sat, Jun 4, 2016 at 5:46 PM, Juri Linkov <juri@linkov.net> wrote:

Maybe this is what you need?

  (defun isearch-for-string ()
    (interactive)
    (isearch-forward nil 1)
    (isearch-yank-string "test"))

Thank you.  That is a nice clean-looking solution.  I had tried isearch-yank-string but missed the recursive-minibuffer argument to the isearch-forward, without which it doesn't work at all which led me to think that isearch-yank-string was not the right approach.  The only limitation with this solution is that if you start to delete search characters, the entire search string provided to the yank is deleted at once rather than character by character.  A pretty minor limitation which is resolved by the first solution, using unread-command-events.

Thanks to all, these have been very helpful and definitely should find some place in the isearch documentation.

Bob