/[emacs]/emacs/src/search.c
ViewVC logotype

Diff of /emacs/src/search.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.186 by rms, Wed Oct 27 10:59:20 2004 UTC revision 1.187 by rms, Fri Nov 19 19:38:26 2004 UTC
# Line 83  static Lisp_Object last_thing_searched; Line 83  static Lisp_Object last_thing_searched;
83    
84  Lisp_Object Qinvalid_regexp;  Lisp_Object Qinvalid_regexp;
85    
86    Lisp_Object Vsearch_whitespace_regexp;
87    
88  static void set_search_regs ();  static void set_search_regs ();
89  static void save_search_regs ();  static void save_search_regs ();
90  static int simple_search ();  static int simple_search ();
# Line 161  compile_pattern_1 (cp, pattern, translat Line 163  compile_pattern_1 (cp, pattern, translat
163    BLOCK_INPUT;    BLOCK_INPUT;
164    old = re_set_syntax (RE_SYNTAX_EMACS    old = re_set_syntax (RE_SYNTAX_EMACS
165                         | (posix ? 0 : RE_NO_POSIX_BACKTRACKING));                         | (posix ? 0 : RE_NO_POSIX_BACKTRACKING));
166    
167      re_set_whitespace_regexp (NILP (Vsearch_whitespace_regexp) ? NULL
168                                : SDATA (Vsearch_whitespace_regexp));
169    
170    val = (char *) re_compile_pattern ((char *)raw_pattern,    val = (char *) re_compile_pattern ((char *)raw_pattern,
171                                       raw_pattern_size, &cp->buf);                                       raw_pattern_size, &cp->buf);
172    
173      re_set_whitespace_regexp (NULL);
174    
175    re_set_syntax (old);    re_set_syntax (old);
176    UNBLOCK_INPUT;    UNBLOCK_INPUT;
177    if (val)    if (val)
# Line 1051  search_buffer (string, pos, pos_byte, li Line 1060  search_buffer (string, pos, pos_byte, li
1060        return pos;        return pos;
1061      }      }
1062    
1063    if (RE && !trivial_regexp_p (string))    if (RE && !(trivial_regexp_p (string) && NILP (Vsearch_whitespace_regexp)))
1064      {      {
1065        unsigned char *p1, *p2;        unsigned char *p1, *p2;
1066        int s1, s2;        int s1, s2;
# Line 2998  syms_of_search () Line 3007  syms_of_search ()
3007    saved_last_thing_searched = Qnil;    saved_last_thing_searched = Qnil;
3008    staticpro (&saved_last_thing_searched);    staticpro (&saved_last_thing_searched);
3009    
3010      DEFVAR_LISP ("search-whitespace-regexp", &Vsearch_whitespace_regexp,
3011          /* doc: Regexp to substitute for bunches of spaces in regexp search.
3012    Some commands use this for user-specified regexps.
3013    Spaces that occur inside character classes or repetition operators
3014    or other such regexp constructs are not replaced with this.
3015    A value of nil (which is the normal value) means treat spaces literally.  */);
3016      Vsearch_whitespace_regexp = Qnil;
3017    
3018    defsubr (&Slooking_at);    defsubr (&Slooking_at);
3019    defsubr (&Sposix_looking_at);    defsubr (&Sposix_looking_at);
3020    defsubr (&Sstring_match);    defsubr (&Sstring_match);

Legend:
Removed from v.1.186  
changed lines
  Added in v.1.187

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26