Mercurial > hg > xemacs-beta
comparison src/search.c @ 367:a4f53d9b3154 r21-1-13
Import from CVS: tag r21-1-13
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:01:07 +0200 |
parents | 57709be46d1b |
children | cc15677e0335 |
comparison
equal
deleted
inserted
replaced
366:83d76f480a59 | 367:a4f53d9b3154 |
---|---|
300 p2 = BI_BUF_CEILING_OF (buf, p1); | 300 p2 = BI_BUF_CEILING_OF (buf, p1); |
301 s1 = p2 - p1; | 301 s1 = p2 - p1; |
302 s2 = BI_BUF_ZV (buf) - p2; | 302 s2 = BI_BUF_ZV (buf) - p2; |
303 | 303 |
304 regex_emacs_buffer = buf; | 304 regex_emacs_buffer = buf; |
305 regex_emacs_buffer_p = 1; | |
305 i = re_match_2 (bufp, (char *) BI_BUF_BYTE_ADDRESS (buf, p1), | 306 i = re_match_2 (bufp, (char *) BI_BUF_BYTE_ADDRESS (buf, p1), |
306 s1, (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, | 307 s1, (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, |
307 BI_BUF_PT (buf) - BI_BUF_BEGV (buf), &search_regs, | 308 BI_BUF_PT (buf) - BI_BUF_BEGV (buf), &search_regs, |
308 BI_BUF_ZV (buf) - BI_BUF_BEGV (buf)); | 309 BI_BUF_ZV (buf) - BI_BUF_BEGV (buf)); |
309 | 310 |
390 : 0), 0, ERROR_ME); | 391 : 0), 0, ERROR_ME); |
391 QUIT; | 392 QUIT; |
392 { | 393 { |
393 Bytecount bis = charcount_to_bytecount (XSTRING_DATA (string), s); | 394 Bytecount bis = charcount_to_bytecount (XSTRING_DATA (string), s); |
394 regex_emacs_buffer = buf; | 395 regex_emacs_buffer = buf; |
396 regex_emacs_buffer_p = 0; | |
395 val = re_search (bufp, (char *) XSTRING_DATA (string), | 397 val = re_search (bufp, (char *) XSTRING_DATA (string), |
396 XSTRING_LENGTH (string), bis, | 398 XSTRING_LENGTH (string), bis, |
397 XSTRING_LENGTH (string) - bis, | 399 XSTRING_LENGTH (string) - bis, |
398 &search_regs); | 400 &search_regs); |
399 } | 401 } |
483 } | 485 } |
484 } | 486 } |
485 | 487 |
486 /* #### evil current-buffer dependency */ | 488 /* #### evil current-buffer dependency */ |
487 regex_emacs_buffer = current_buffer; | 489 regex_emacs_buffer = current_buffer; |
490 regex_emacs_buffer_p = 0; | |
488 val = re_search (bufp, (char *) newnonreloc + offset, length, 0, | 491 val = re_search (bufp, (char *) newnonreloc + offset, length, 0, |
489 length, 0); | 492 length, 0); |
490 | 493 |
491 no_quit_in_re_search = 0; | 494 no_quit_in_re_search = 0; |
492 return val; | 495 return val; |
1119 while (n < 0) | 1122 while (n < 0) |
1120 { | 1123 { |
1121 Bytecount val; | 1124 Bytecount val; |
1122 QUIT; | 1125 QUIT; |
1123 regex_emacs_buffer = buf; | 1126 regex_emacs_buffer = buf; |
1127 regex_emacs_buffer_p = 1; | |
1124 val = re_search_2 (bufp, | 1128 val = re_search_2 (bufp, |
1125 (char *) BI_BUF_BYTE_ADDRESS (buf, p1), s1, | 1129 (char *) BI_BUF_BYTE_ADDRESS (buf, p1), s1, |
1126 (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, | 1130 (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, |
1127 pos - BI_BUF_BEGV (buf), lim - pos, &search_regs, | 1131 pos - BI_BUF_BEGV (buf), lim - pos, &search_regs, |
1128 pos - BI_BUF_BEGV (buf)); | 1132 pos - BI_BUF_BEGV (buf)); |
1157 while (n > 0) | 1161 while (n > 0) |
1158 { | 1162 { |
1159 Bytecount val; | 1163 Bytecount val; |
1160 QUIT; | 1164 QUIT; |
1161 regex_emacs_buffer = buf; | 1165 regex_emacs_buffer = buf; |
1166 regex_emacs_buffer_p = 1; | |
1162 val = re_search_2 (bufp, | 1167 val = re_search_2 (bufp, |
1163 (char *) BI_BUF_BYTE_ADDRESS (buf, p1), s1, | 1168 (char *) BI_BUF_BYTE_ADDRESS (buf, p1), s1, |
1164 (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, | 1169 (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, |
1165 pos - BI_BUF_BEGV (buf), lim - pos, &search_regs, | 1170 pos - BI_BUF_BEGV (buf), lim - pos, &search_regs, |
1166 lim - BI_BUF_BEGV (buf)); | 1171 lim - BI_BUF_BEGV (buf)); |
2034 make_int (strpos))); | 2039 make_int (strpos))); |
2035 else | 2040 else |
2036 newtext = accum; | 2041 newtext = accum; |
2037 } | 2042 } |
2038 | 2043 |
2044 /* newtext can be nil. */ | |
2045 if (NILP (newtext)) | |
2046 newtext = build_string (""); | |
2047 | |
2039 if (case_action == all_caps) | 2048 if (case_action == all_caps) |
2040 newtext = Fupcase (newtext, buffer); | 2049 newtext = Fupcase (newtext, buffer); |
2041 else if (case_action == cap_initial) | 2050 else if (case_action == cap_initial) |
2042 newtext = Fupcase_initials (newtext, buffer); | 2051 newtext = Fupcase_initials (newtext, buffer); |
2043 | 2052 |