From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Strange behavior of word isearch Date: Wed, 24 Sep 2008 23:46:02 -0400 Message-ID: <87k5d099c5.fsf@cyd.mit.edu> References: <874p46ztmq.fsf@cyd.mit.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1222314346 26081 80.91.229.12 (25 Sep 2008 03:45:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Sep 2008 03:45:46 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 25 05:46:44 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KihoR-0000Nw-J2 for ged-emacs-devel@m.gmane.org; Thu, 25 Sep 2008 05:46:43 +0200 Original-Received: from localhost ([127.0.0.1]:36909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KihnP-0007xv-5q for ged-emacs-devel@m.gmane.org; Wed, 24 Sep 2008 23:45:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KihnL-0007xl-G3 for emacs-devel@gnu.org; Wed, 24 Sep 2008 23:45:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KihnJ-0007xQ-G8 for emacs-devel@gnu.org; Wed, 24 Sep 2008 23:45:34 -0400 Original-Received: from [199.232.76.173] (port=36296 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KihnJ-0007xN-BR for emacs-devel@gnu.org; Wed, 24 Sep 2008 23:45:33 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]:58373) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KihnJ-0005d2-4Y for emacs-devel@gnu.org; Wed, 24 Sep 2008 23:45:33 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 3E89757E189; Wed, 24 Sep 2008 23:46:02 -0400 (EDT) In-Reply-To: <874p46ztmq.fsf@cyd.mit.edu> (Chong Yidong's message of "Tue, 23 Sep 2008 12:58:37 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:104130 Archived-At: Chong Yidong writes: > The isearch word commands that you checked in a couple of months ago > seem pretty buggy. The search never succeeds. For example, if I try to > search for the words "learn basic" in the Emacs welcome screen: > > emacs -q Enters the welcome screen > > M-s w Starts isearch-forward-word > > l Emacs beeps and the prompt says "Failing word I-search:" > > earn The prompt still says "Failing word I-search:" > even though the word "learn" is now highlighted as an > "other match". > > SPC The prompt still says "Failing word I-search:" > > basic The prompt still says "Failing word I-search:" The trouble here is that word-search-forward appends a \b regexp condition to the end of the search string, so it does not treat "learn" as a match for "l". Is this behavior useful in practice? If not, the following patch removes the \b condition, which is an incompatible change to the behavior of word-search-forward. In other words, previously a word search for "foo" is a regexp search for "\bfoo\b"; this patch changes the search to "\bfoo". Or, it may be safer to either introduce a function that is similar to word-search-forward but without the \b condition, or a variable that turns that behavior off; and use that in isearch. What do people think? *** trunk/src/search.c.~1.234.~ 2008-08-27 10:30:40.000000000 -0400 --- trunk/src/search.c 2008-09-24 23:35:07.000000000 -0400 *************** *** 2154,2160 **** if (!word_count) return empty_unibyte_string; ! adjust = - punct_count + 5 * (word_count - 1) + 4; if (STRING_MULTIBYTE (string)) val = make_uninit_multibyte_string (len + adjust, SBYTES (string) --- 2154,2160 ---- if (!word_count) return empty_unibyte_string; ! adjust = - punct_count + 5 * (word_count - 1) + 2; if (STRING_MULTIBYTE (string)) val = make_uninit_multibyte_string (len + adjust, SBYTES (string) *************** *** 2192,2200 **** prev_c = c; } - *o++ = '\\'; - *o++ = 'b'; - return val; } --- 2192,2197 ----