emacs-devel
[Top][All Lists]
Advanced

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

Re: Strange behavior of word isearch


From: Chong Yidong
Subject: Re: Strange behavior of word isearch
Date: Wed, 24 Sep 2008 23:46:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Chong Yidong <address@hidden> 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 ----




reply via email to

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