I use C-s to start an incremental search. Sometimes I want to change the search string and either restart the search entirely from the beginning of the document or (other times) just change the search string and proceed from current location. How does one do this?

1 Answer 1

  1. During Isearch M-e is bound to isearch-edit-string. It pauses Isearch and puts the current search string in the minibuffer so you can edit it. Just use C-s again to resume searching from the current position but with the new search string.

    (I know it looks like your search string is already always in the minibuffer during Isearch, but it is not. I you use some kind of indicator of minibuffer depth then you can see the difference. For example, I use a standalone minibuffer frame, and its background changes when the minibuffer is active. And it changes to a different hue for each recursive edit (minibuffer depth). And it changes to yet another hue for Isearch.)

  2. You can use C-h C-h b during Isearch to see a list of all of the Isearch key bindings (where you can find M-e).

    If you use Isearch+ then just C-h shows you detailed help, including bindings such as M-e.

    If you use library help-fns+.el then C-h M-k isearch-mode-map shows you all keys bound on that keymap, in human-readable form.

  3. With Isearch+ you can also interrupt Isearch completely, do some editing or whatever, and then resume where you left off and with the same search state. (The latter is not the case if you stop Isearch and restart it at the location where you left off.)

    To do that, use C-x o (isearchp-open-recursive-edit). Resume searching with exit-recursive-edit (bound to C-M-c).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.