bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: yank char by char onto end of search string


From: Juri Linkov
Subject: Re: yank char by char onto end of search string
Date: Fri, 28 Nov 2003 09:27:55 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Dan Jacobson <jidanni@jidanni.org> writes:
> Gentlemen,
>   C-s runs the command isearch-forward...
>   Type C-w to yank word from buffer onto end of search string and search for 
> it.
>   Type C-y to yank rest of line onto end of search string and search for it.
> Yes, but how about also providing a key to just yank one character at a time?!
> Indeed, often a whole word is just to much.  Why, how could Stallman
> never have though of this?

I've already used isearch yank char feature for years.
Here is what I have in my .emacs:

,----
| (define-key isearch-mode-map "\C-f" 'isearch-yank-char)
| (defun isearch-yank-char ()
|   "Pull next character from buffer into search string."
|   (interactive)
|   (isearch-yank-string
|    (save-excursion
|      (and (not isearch-forward) isearch-other-end
|         (goto-char isearch-other-end))
|      (buffer-substring (point) (min (1+ (point)) (point-max))))))
`----

Sorry, I have not yet submitted a patch for isearch.el [I have many
other unsubmitted enhancements too].

Even though isearch in CVS already has a new function
isearch-yank-word-or-char that uses a heuristic to decide
to grab either a character or a word, it rarely guesses it right.

Most often there is a need to search only a part of word, for example,
to search all forms of a word (both singular and plural forms, all
inflected verbs, etc.)  To do this the function `isearch-yank-char' is
needed to yank a whole word char by char without ending
(such as "-s", "-ing", "-ed").

Very often this function is useful to yank a word without final
single quote (') which in some syntaxes is part of a word.

-- 
http://www.jurta.org/emacs/





reply via email to

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