3

I don't isearch backwards frequently enough to justify giving it such a valuable keybinding, so I rebound isearch-backward-regexp to C-c r and I noticed that something strange started happening. Normally isearch-backward-regexp will use the previous search string and jump to the previous match if you hit C-r twice, but the search string in the minibuffer always cleared when you rebind isearch-backward-regexp to a compound keybinding.

1
  • I can't reproduce the problem.
    – Dan
    Aug 27, 2015 at 17:52

1 Answer 1

4

This is because normally when you repeat an isearch command it executes the isearch-repeat-forward or isearch-repeat-backward command to save your search string (you can find this out by doing C-h k in the minibuffer). The following should fix this for your keybind:

(define-key isearch-mode-map (kbd "C-c r") 'isearch-repeat-backward)

1
  • Thanks! I didn't realize the isearch-mode-map was in effect Aug 27, 2015 at 21:01

Your Answer

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

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