emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104087: New command isearch-yank-pop


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104087: New command isearch-yank-pop and bind it to `M-y' in Isearch
Date: Tue, 03 May 2011 11:34:26 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104087
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Tue 2011-05-03 11:34:26 +0800
message:
  New command isearch-yank-pop and bind it to `M-y' in Isearch
modified:
  etc/ChangeLog
  etc/NEWS
  lisp/ChangeLog
  lisp/isearch.el
=== modified file 'etc/ChangeLog'
--- a/etc/ChangeLog     2011-05-03 00:48:07 +0000
+++ b/etc/ChangeLog     2011-05-03 03:34:26 +0000
@@ -1,3 +1,7 @@
+2011-05-03  Leo Liu  <address@hidden>
+
+       * NEWS: Mention the new command isearch-yank-pop.
+
 2011-05-03  Teodor Zlatanov  <address@hidden>
 
        * NEWS: Mention new library gnutls.el and explain GnuTLS

=== modified file 'etc/NEWS'
--- a/etc/NEWS  2011-05-03 00:48:07 +0000
+++ b/etc/NEWS  2011-05-03 03:34:26 +0000
@@ -281,6 +281,10 @@
 *** 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.
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-05-03 01:52:52 +0000
+++ b/lisp/ChangeLog    2011-05-03 03:34:26 +0000
@@ -1,3 +1,9 @@
+2011-05-03  Leo Liu  <address@hidden>
+
+       * isearch.el (isearch-yank-pop): New command.
+       (isearch-mode-map): bind it to `M-y'.
+       (isearch-forward): Mention it.
+
 2011-05-03  Stefan Monnier  <address@hidden>
 
        * simple.el (minibuffer-complete-shell-command): Remove.

=== modified file 'lisp/isearch.el'
--- a/lisp/isearch.el   2011-04-19 13:44:55 +0000
+++ b/lisp/isearch.el   2011-05-03 03:34:26 +0000
@@ -473,7 +473,7 @@
 
     (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-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 @@
   (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]