New command isearch-yank-pop and bind it to `M-y' in Isearch

This commit is contained in:
Leo Liu 2011-05-03 11:34:26 +08:00
parent 1bcace585f
commit 256661260d
4 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2011-05-03 Leo Liu <sdl.web@gmail.com>
* NEWS: Mention the new command isearch-yank-pop.
2011-05-03 Teodor Zlatanov <tzz@lifelogs.com>
* NEWS: Mention new library gnutls.el and explain GnuTLS

View file

@ -281,6 +281,10 @@ replaced with Lisp commands `doc-file-to-man' and `doc-file-to-info'.
*** C-y in Isearch is now bound to isearch-yank-kill, instead of
isearch-yank-line.
---
*** M-y in Isearch is now bound to isearch-yank-pop, instead of
isearch-yank-kill.
+++
*** M-s C-e in Isearch is now bound to isearch-yank-line.

View file

@ -1,3 +1,9 @@
2011-05-03 Leo Liu <sdl.web@gmail.com>
* isearch.el (isearch-yank-pop): New command.
(isearch-mode-map): bind it to `M-y'.
(isearch-forward): Mention it.
2011-05-03 Stefan Monnier <monnier@iro.umontreal.ca>
* simple.el (minibuffer-complete-shell-command): Remove.

View file

@ -473,7 +473,7 @@ This is like `describe-bindings', but displays only Isearch keys."
(define-key map "\M-n" 'isearch-ring-advance)
(define-key map "\M-p" 'isearch-ring-retreat)
(define-key map "\M-y" 'isearch-yank-kill)
(define-key map "\M-y" 'isearch-yank-pop)
(define-key map "\M-\t" 'isearch-complete)
@ -637,6 +637,8 @@ Type \\[isearch-yank-char] to yank char from buffer onto end of search\
Type \\[isearch-yank-line] to yank rest of line onto end of search string\
and search for it.
Type \\[isearch-yank-kill] to yank the last string of killed text.
Type \\[isearch-yank-pop] to replace string just yanked into search prompt
with string killed before it.
Type \\[isearch-quote-char] to quote control character to search for it.
\\[isearch-abort] while searching or when search has failed cancels input\
back to what has
@ -1497,6 +1499,18 @@ If search string is empty, just beep."
(interactive)
(isearch-yank-string (current-kill 0)))
(defun isearch-yank-pop ()
"Replace just-yanked search string with previously killed string."
(interactive)
(if (not (memq last-command '(isearch-yank-kill isearch-yank-pop)))
;; Fall back on `isearch-yank-kill' for the benefits of people
;; who are used to the old behavior of `M-y' in isearch mode. In
;; future, this fallback may be changed if we ever change
;; `yank-pop' to do something like the kill-ring-browser.
(isearch-yank-kill)
(isearch-pop-state)
(isearch-yank-string (current-kill 1))))
(defun isearch-yank-x-selection ()
"Pull current X selection into search string."
(interactive)