comparison src/syntax.c @ 58897:98e94b29b59b

(Fforward_word): Avoid non-idempotent side-effects in macro arguments.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 11 Dec 2004 21:59:15 +0000
parents a8bc01ac68d0
children bb4ab751a6a3 fb79180b618d
comparison
equal deleted inserted replaced
58896:dc2516edbe6c 58897:98e94b29b59b
1293 and the function returns nil. Field boundaries are not noticed if 1293 and the function returns nil. Field boundaries are not noticed if
1294 `inhibit-field-text-motion' is non-nil. */) 1294 `inhibit-field-text-motion' is non-nil. */)
1295 (arg) 1295 (arg)
1296 Lisp_Object arg; 1296 Lisp_Object arg;
1297 { 1297 {
1298 Lisp_Object tmp;
1298 int orig_val, val; 1299 int orig_val, val;
1299 1300
1300 if (NILP (arg)) 1301 if (NILP (arg))
1301 XSETFASTINT (arg, 1); 1302 XSETFASTINT (arg, 1);
1302 else 1303 else
1305 val = orig_val = scan_words (PT, XINT (arg)); 1306 val = orig_val = scan_words (PT, XINT (arg));
1306 if (! orig_val) 1307 if (! orig_val)
1307 val = XINT (arg) > 0 ? ZV : BEGV; 1308 val = XINT (arg) > 0 ? ZV : BEGV;
1308 1309
1309 /* Avoid jumping out of an input field. */ 1310 /* Avoid jumping out of an input field. */
1310 val = XFASTINT (Fconstrain_to_field (make_number (val), make_number (PT), 1311 tmp = Fconstrain_to_field (make_number (val), make_number (PT),
1311 Qt, Qnil, Qnil)); 1312 Qt, Qnil, Qnil);
1313 val = XFASTINT (tmp);
1312 1314
1313 SET_PT (val); 1315 SET_PT (val);
1314 return val == orig_val ? Qt : Qnil; 1316 return val == orig_val ? Qt : Qnil;
1315 } 1317 }
1316 1318