Subject: Re: bug#6232: Suggestion for isearch: in backward search yank to front of search string

From: Leo <[email-masked]>
Date: Fri, 21 May 2010 10:54:36 +0100

On 2010-05-21 09:27 +0100, Andreas Schwab wrote:
> Lennart Borgman <[email-masked]> writes:
>
>> Yanking to the end of the search string in isearh (i.e. C-w etc.) is
>> very practical. However I miss yanking to the front of the search
>> string.
>>
>> My suggestion is to change the semantics a bit and yank to the front
>> of the search string when searching backwards. What do you think?
>
> Such a feature should definitely be on a separate key.
>
> Andreas.

C-y is almost useless to me so I have done something like this:

(define-key isearch-mode-map [remap isearch-yank-line] 'isearch-yank-sexp)

(defun isearch-yank-sexp ()
  "Pull the sexp at point into search string."
  (interactive)
  (if (and isearch-just-started (bounds-of-thing-at-point 'sexp))
      (progn (goto-char (car (bounds-of-thing-at-point 'sexp)))
             (isearch-yank-string (thing-at-point 'sexp)))
    (isearch-yank-internal
     (lambda () (ignore-errors (forward-sexp 1)) (point)))))

Leo