comparison src/search.c @ 4882:8c09f87f5087

(Freplace_match): Fix argument names to match doc string. (Fmatch_beginning): Fix doc string to match argument name.
author Brian Fox <bfox@gnu.org>
date Mon, 25 Oct 1993 05:09:20 +0000
parents 88df989388b9
children be690aaa7194
comparison
equal deleted inserted replaced
4881:e53d4ae93675 4882:8c09f87f5087
1160 `\\N' means substitute what matched the Nth `\\(...\\)'.\n\ 1160 `\\N' means substitute what matched the Nth `\\(...\\)'.\n\
1161 If Nth parens didn't match, substitute nothing.\n\ 1161 If Nth parens didn't match, substitute nothing.\n\
1162 `\\\\' means insert one `\\'.\n\ 1162 `\\\\' means insert one `\\'.\n\
1163 FIXEDCASE and LITERAL are optional arguments.\n\ 1163 FIXEDCASE and LITERAL are optional arguments.\n\
1164 Leaves point at end of replacement text.") 1164 Leaves point at end of replacement text.")
1165 (string, fixedcase, literal) 1165 (newtext, fixedcase, literal)
1166 Lisp_Object string, fixedcase, literal; 1166 Lisp_Object newtext, fixedcase, literal;
1167 { 1167 {
1168 enum { nochange, all_caps, cap_initial } case_action; 1168 enum { nochange, all_caps, cap_initial } case_action;
1169 register int pos, last; 1169 register int pos, last;
1170 int some_multiletter_word; 1170 int some_multiletter_word;
1171 int some_lowercase; 1171 int some_lowercase;
1172 int some_uppercase_initial; 1172 int some_uppercase_initial;
1173 register int c, prevc; 1173 register int c, prevc;
1174 int inslen; 1174 int inslen;
1175 1175
1176 CHECK_STRING (string, 0); 1176 CHECK_STRING (newtext, 0);
1177 1177
1178 case_action = nochange; /* We tried an initialization */ 1178 case_action = nochange; /* We tried an initialization */
1179 /* but some C compilers blew it */ 1179 /* but some C compilers blew it */
1180 1180
1181 if (search_regs.num_regs <= 0) 1181 if (search_regs.num_regs <= 0)
1240 delete the original text. This means that markers at the 1240 delete the original text. This means that markers at the
1241 beginning or end of the original will float to the corresponding 1241 beginning or end of the original will float to the corresponding
1242 position in the replacement. */ 1242 position in the replacement. */
1243 SET_PT (search_regs.start[0]); 1243 SET_PT (search_regs.start[0]);
1244 if (!NILP (literal)) 1244 if (!NILP (literal))
1245 Finsert_and_inherit (1, &string); 1245 Finsert_and_inherit (1, &newtext);
1246 else 1246 else
1247 { 1247 {
1248 struct gcpro gcpro1; 1248 struct gcpro gcpro1;
1249 GCPRO1 (string); 1249 GCPRO1 (newtext);
1250 1250
1251 for (pos = 0; pos < XSTRING (string)->size; pos++) 1251 for (pos = 0; pos < XSTRING (newtext)->size; pos++)
1252 { 1252 {
1253 int offset = point - search_regs.start[0]; 1253 int offset = point - search_regs.start[0];
1254 1254
1255 c = XSTRING (string)->data[pos]; 1255 c = XSTRING (newtext)->data[pos];
1256 if (c == '\\') 1256 if (c == '\\')
1257 { 1257 {
1258 c = XSTRING (string)->data[++pos]; 1258 c = XSTRING (newtext)->data[++pos];
1259 if (c == '&') 1259 if (c == '&')
1260 Finsert_buffer_substring 1260 Finsert_buffer_substring
1261 (Fcurrent_buffer (), 1261 (Fcurrent_buffer (),
1262 make_number (search_regs.start[0] + offset), 1262 make_number (search_regs.start[0] + offset),
1263 make_number (search_regs.end[0] + offset)); 1263 make_number (search_regs.end[0] + offset));
1306 : search_regs.end[n])); 1306 : search_regs.end[n]));
1307 } 1307 }
1308 1308
1309 DEFUN ("match-beginning", Fmatch_beginning, Smatch_beginning, 1, 1, 0, 1309 DEFUN ("match-beginning", Fmatch_beginning, Smatch_beginning, 1, 1, 0,
1310 "Return position of start of text matched by last search.\n\ 1310 "Return position of start of text matched by last search.\n\
1311 ARG, a number, specifies which parenthesized expression in the last regexp.\n\ 1311 NUM specifies which parenthesized expression in the last regexp.\n\
1312 Value is nil if ARGth pair didn't match, or there were less than ARG pairs.\n\ 1312 Value is nil if NUMth pair didn't match, or there were less than NUM pairs.\n\
1313 Zero means the entire text matched by the whole regexp or whole string.") 1313 Zero means the entire text matched by the whole regexp or whole string.")
1314 (num) 1314 (num)
1315 Lisp_Object num; 1315 Lisp_Object num;
1316 { 1316 {
1317 return match_limit (num, 1); 1317 return match_limit (num, 1);