0

When doing a yank after an isearch-forward/backward, the most natural thing that one wishes to happen is to isearch the string provided by that yank. How to realize this?

  • Can you explain a little more what you mean? It's already the case that if you C-s C-y, it'll yank text into the minibuffer, and isearch will search the text in the buffer for the yanked text. – zck Jul 29 '15 at 17:31
  • Are you sure? For me I have to press C-y two times to achieve this (i.e. C-s C-y C-y). But the natural thing is to press C-s C-y as you said. I have the impression that it is because when doing C-s the minibuffer is not in focus. – Name Jul 29 '15 at 17:41
  • Yeah, C-s C-y definitely works for me. I'm using Emacs 24.4; how about you? Does it also not work starting from emacs -Q? – zck Jul 29 '15 at 17:47
  • 2
    @Name Search for what C-y is bound to in the isearch-mode-map by isearch+. Keeping this question might be useful for people facing the same confusion. You can answer your own question. – Kaushal Modi Jul 29 '15 at 18:02
  • 1
    Check that package's documentation in its header; by design you need to hit C-y C-y to do the usual yank: ;; `C-y C-y' `isearch-yank-kill'. – Kaushal Modi Jul 29 '15 at 18:04
1

You say:

Recently I have installed the packages isearch+ when I remove the line (require 'isearch+) from my init file, the problem is solved.

@kaushalmodi said:

Search for what C-y is bound to in the isearch-mode-map by isearch+.

and

Check that package's documentation in its header; by design you need to hit C-y C-y to do the usual yank:

;; C-y C-y isearch-yank-kill.

By default, C-y is a prefix key in Isearch+. There are multiple yank commands, all bound to keys on prefix C-y. C-y C-y is bound by default to isearch-yank-kill.

You can of course bind any key you like (in isearch-mode-map) to any Isearch command, including to isearch-yank-kill:

(define-key isearch-mode-map (kbd "WHATEVER") 'isearch-yank-kill)

FYI -- You can not only get this info from the isearch+.el library file header, as @kaushalmodi pointed out. You can also use C-s C-h to see all bindings in the Isearch-mode keymap. And if you use library help-fns+.el then you can also use C-h M-k isearch-mode-map to see a human-readable description of all of the keys and their commands.

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.