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.

  • I can't reproduce the problem. – Dan Aug 27 '15 at 17:52
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)

  • Thanks! I didn't realize the isearch-mode-map was in effect – Gregory Nisbet Aug 27 '15 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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