From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: isearch-yank-char Date: Mon, 26 Apr 2004 07:42:08 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <874qr7l59b.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1082955169 27938 80.91.224.253 (26 Apr 2004 04:52:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Apr 2004 04:52:49 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Apr 26 06:52:40 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BHy6i-0001an-00 for ; Mon, 26 Apr 2004 06:52:40 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BHy6i-0001S5-00 for ; Mon, 26 Apr 2004 06:52:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BHy2b-0003yq-0j for emacs-devel@quimby.gnus.org; Mon, 26 Apr 2004 00:48:25 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BHy2T-0003xa-Lh for emacs-devel@gnu.org; Mon, 26 Apr 2004 00:48:17 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BHy1t-0003r0-Sn for emacs-devel@gnu.org; Mon, 26 Apr 2004 00:48:14 -0400 Original-Received: from [66.33.219.19] (helo=spoon.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BHy1t-0003qm-Fn for emacs-devel@gnu.org; Mon, 26 Apr 2004 00:47:41 -0400 Original-Received: from mail.jurta.org (80-235-33-250-dsl.mus.estpak.ee [80.235.33.250]) by spoon.dreamhost.com (Postfix) with ESMTP id 87C3B13D8E2 for ; Sun, 25 Apr 2004 21:47:44 -0700 (PDT) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22146 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22146 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/