Emacs 24.1: How do I restore i-search Ctrl-Y behavior from older versions?

Posted by Eric on Super User See other posts from Super User or by Eric
Published on 2012-11-21T22:52:37Z Indexed on 2012/11/21 23:01 UTC
Read the original article Hit count: 244

Filed under:

In emacs 24.1, when you do Ctrl-Y in an interactive search, it yanks the kill buffer into the search string ("it pastes the clipboard contents" in any-other-app's language) and tries to match it.

In the last 20 versions or so, pressing Ctrl-Y matches the rest of the current line. I have two very common use cases:

  1. Match this line, revert the buffer, and search for the line

  2. (less often:) Where else is this text in the buffer?

I tried modifying /lisp/isearch.el, switching the bindings for isearch-yank-line (which I want) and isearch-yank-kill (which I'm fine binding to the ridiculous \M-s\C-e key sequence). But I don't think this file even gets picked up. But I don't think this file even gets loaded. If I explicitly load it, I still get the 24.1 behavior.

Here's my change:

(add-hook 'isearch-mode-hook
   (lambda ()
     (define-key isearch-mode-map    "\C-y" 'isearch-yank-line)
     (define-key isearch-mode-map "\M-s\C-e" 'isearch-yank-kill)
    ))

No change in the behavior. I even tried hacking isearch.el, still no change.

This is on Windows btw, but I suspect it doesn't matter.

Could someone tell me how I can restore the old binding?

© Super User or respective owner

Related posts about emacs