[Top][All Lists]

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

Re: isearch-yank-char

From: Karl Fogel
Subject: Re: isearch-yank-char
Date: 25 Apr 2004 18:03:29 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Juri Linkov <address@hidden> writes:
> There is an inevitable need for a key binding for isearch-yank-char.
> The current C-w key binding for isearch-yank-word-or-char tries
> to decide whether the user wants a character or a word, but it
> often fails, because it is impossible to predict what the user wants.

For more of the history behind this, see


The archive seems not to have caught every mail in the thread,
unfortunately.  For example, Richard Stallman sent this mail, but it
does not appear to be in the archive:

  | From: Richard Stallman <address@hidden>
  | Subject: Re: isearch C-o patch (post-freeze resubmission)
  | To: address@hidden
  | CC: address@hidden, address@hidden
  | Date: Thu, 29 Nov 2001 12:18:25 -0700 (MST)
  | Reply-to: address@hidden
  |     However, I would much rather change the behaviour of C-w so that it
  |     copies a `word' if it is on a `word character' and a single
  |     character otherwise.  Then I could C-w C-w C-w to copy
  |     word+= into the minibuffer (and use backspace if I got too much).
  | This seems like an idea worth trying.  Would you like to do it?

I don't know what else might be missing (haven't done a careful
survey), but anyway I think what's in the archive is complete enough
to give all relevant context.

> The need to grab a part of a word into search string is valid for many
> languages, even for English, for example, to search all forms of a
> word (e.g. singular and plural forms, inflected verbs, etc.) by
> grabbing the word root from the buffer and omitting word endings
> (such as "-s", "-ing", "-ed").

Yes.  At first, I thought having C-w be more sophisticated would be
enough, but in practice, finer-grained control is often necessary.

> I guess that isearch-yank-char has no key binding yet, because it is
> difficult to choose a good one.  I looked at all possible key bindings,
> and it seems that the best key binding is C-f.  It is most suitable
> semantically: normally, C-f runs forward-char, and isearch-yank-char
> has a similar functionality by operating on characters.

The original binding was C-o, but C-f seems like a better choice, for
the reasons you give.

> But most importantly, C-f is the most backward compatible key binding,
> because when the user types C-f without leaving isearch mode with the
> intention to move the point right, nothing bad happens: the user
> simply types RET or any other non-isearch key to finish isearch, and
> the point remains exactly at the same position where the user wanted
> to move it!  In other words, `C-s ...  C-f RET' is equivalent to
> `C-s ...  RET C-f'.

A thought: can we then bind C-b to *lose* a single character from the
search string?  The same logic applies to both C-f and C-b, and wow,
it sure would be convenient to have something finer than Backspace
(since Backspace usually loses too much!).

Of course, the patch for that would be a bit more complex than just
binding a key.  But if people think it is a good idea, I will be
happy to write it.

In any case, binding C-f to isearch-yank-char seems like a fine idea.


reply via email to

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