[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: M-y in isearch mode
From: |
Stefan Monnier |
Subject: |
Re: M-y in isearch mode |
Date: |
Mon, 02 May 2011 13:27:55 -0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> I would like to propose binding M-y to a new command isearch-yank-pop as
> in the attached patch. Please review it.
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?
Stefan
> === modified file 'lisp/isearch.el'
> --- lisp/isearch.el 2011-04-19 13:44:55 +0000
> +++ lisp/isearch.el 2011-05-02 13:51:48 +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.
> +This command is allowed only immediately after a
> +`isearch-yank-kill' or `isearch-yank-pop'."
> + (interactive)
> + (if (not (memq last-command '(isearch-yank-kill isearch-yank-pop)))
> + (let ((isearch-message-suffix-add
> + " [previous isearch command was not a yank]"))
> + (isearch-update))
> + (isearch-pop-state)
> + (isearch-yank-string (current-kill 1))))
> +
> (defun isearch-yank-x-selection ()
> "Pull current X selection into search string."
> (interactive)