[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
isearch-yank-char
From: |
Juri Linkov |
Subject: |
isearch-yank-char |
Date: |
Mon, 26 Apr 2004 07:42:08 +0300 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
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.
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").
Another example where this key binding is needed is Emacs modes which
give word syntax to non-word characters. For example, in Info mode
it is impossible to grab a function or variable name into search
string as a word, because it grabs the apostrophe character used
for quoting as part of the function name.
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.
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'.
Index: lisp/isearch.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.226
diff -u -r1.226 isearch.el
--- lisp/isearch.el 4 Mar 2004 16:54:08 -0000 1.226
+++ lisp/isearch.el 26 Apr 2004 04:34:14 -0000
@@ -294,7 +294,8 @@
(define-key map " " 'isearch-whitespace-chars)
(define-key map [?\S-\ ] 'isearch-whitespace-chars)
- (define-key map "\C-w" 'isearch-yank-word-or-char)
+ (define-key map "\C-f" 'isearch-yank-char)
+ (define-key map "\C-w" 'isearch-yank-word)
(define-key map "\C-y" 'isearch-yank-line)
--
Juri Linkov
http://www.jurta.org/emacs/
- isearch-yank-char,
Juri Linkov <=