summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/ChangeLog4
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/isearch.el16
4 files changed, 29 insertions, 1 deletions
diff --git a/etc/ChangeLog b/etc/ChangeLog
index f7e40aa2c67..0eb21406105 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -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
diff --git a/etc/NEWS b/etc/NEWS
index 8aa503c5dd8..5094ecfc4fc 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 63fef4f8069..aa9052adfb4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 1e6ac9c024e..7db7f30dd89 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -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)