unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* yank char by char onto end of search string
@ 2003-11-28  2:44 Dan Jacobson
  2003-11-28  7:27 ` Juri Linkov
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Jacobson @ 2003-11-28  2:44 UTC (permalink / raw)


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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: yank char by char onto end of search string
  2003-11-28  2:44 yank char by char onto end of search string Dan Jacobson
@ 2003-11-28  7:27 ` Juri Linkov
  0 siblings, 0 replies; 2+ messages in thread
From: Juri Linkov @ 2003-11-28  7:27 UTC (permalink / raw)
  Cc: bug-gnu-emacs

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-11-28  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-28  2:44 yank char by char onto end of search string Dan Jacobson
2003-11-28  7:27 ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).