[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: M-y in isearch mode
From: |
Leo |
Subject: |
Re: M-y in isearch mode |
Date: |
Tue, 03 May 2011 00:51:28 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3.50 (Mac OS X 10.6.7) |
On 2011-05-03 00:27 +0800, Stefan Monnier wrote:
> Now that C-y is bound to isearch-yank-kill, it would indeed make sense
> for M-y to match the behavior of M-y outside isearch.
>
> But maybe for compatibility with old "finger memory", we should allow
> a M-y that does not follow isearch-yank-kill isearch-yank-pop.
> I.e. rather than signal a "previous isearch command was not a yank", we
> should simply turn it into an isearch-yank-kill.
> WDYT?
Sounds good. Patch modified to this suggestion.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index e59fb29a..04d41af2 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -472,7 +472,7 @@ (defvar isearch-mode-map
(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)
@@ -636,6 +636,8 @@ (defun isearch-forward (&optional regexp-p
no-recursive-edit)
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
@@ -1499,6 +1501,14 @@ (defun isearch-yank-kill ()
(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)))
+ (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)