Mercurial > emacs
comparison src/undo.c @ 7671:31d444fcae24
(Fprimitive_undo): GCPRO next and list.
Check argument type before calling XINT.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 25 May 1994 02:22:08 +0000 |
parents | 99e9c133a752 |
children | c0287cefc0f8 |
comparison
equal
deleted
inserted
replaced
7670:b3be53811505 | 7671:31d444fcae24 |
---|---|
333 "Undo N records from the front of the list LIST.\n\ | 333 "Undo N records from the front of the list LIST.\n\ |
334 Return what remains of the list.") | 334 Return what remains of the list.") |
335 (n, list) | 335 (n, list) |
336 Lisp_Object n, list; | 336 Lisp_Object n, list; |
337 { | 337 { |
338 struct gcpro gcpro1, gcpro2; | |
339 Lisp_Object next; | |
338 int count = specpdl_ptr - specpdl; | 340 int count = specpdl_ptr - specpdl; |
339 register int arg = XINT (n); | 341 register int arg; |
340 #if 0 /* This is a good feature, but would make undo-start | 342 #if 0 /* This is a good feature, but would make undo-start |
341 unable to do what is expected. */ | 343 unable to do what is expected. */ |
342 Lisp_Object tem; | 344 Lisp_Object tem; |
343 | 345 |
344 /* If the head of the list is a boundary, it is the boundary | 346 /* If the head of the list is a boundary, it is the boundary |
346 tem = Fcar (list); | 348 tem = Fcar (list); |
347 if (NILP (tem)) | 349 if (NILP (tem)) |
348 list = Fcdr (list); | 350 list = Fcdr (list); |
349 #endif | 351 #endif |
350 | 352 |
353 CHECK_NUMBER (n, 0); | |
354 arg = XINT (n); | |
355 next = Qnil; | |
356 GCPRO2 (next, list); | |
357 | |
351 /* Don't let read-only properties interfere with undo. */ | 358 /* Don't let read-only properties interfere with undo. */ |
352 if (NILP (current_buffer->read_only)) | 359 if (NILP (current_buffer->read_only)) |
353 specbind (Qinhibit_read_only, Qt); | 360 specbind (Qinhibit_read_only, Qt); |
354 | 361 |
355 while (arg > 0) | 362 while (arg > 0) |
356 { | 363 { |
357 while (1) | 364 while (1) |
358 { | 365 { |
359 Lisp_Object next; | |
360 next = Fcar (list); | 366 next = Fcar (list); |
361 list = Fcdr (list); | 367 list = Fcdr (list); |
362 /* Exit inner loop at undo boundary. */ | 368 /* Exit inner loop at undo boundary. */ |
363 if (NILP (next)) | 369 if (NILP (next)) |
364 break; | 370 break; |
453 } | 459 } |
454 } | 460 } |
455 arg--; | 461 arg--; |
456 } | 462 } |
457 | 463 |
464 UNGCPRO; | |
458 return unbind_to (count, list); | 465 return unbind_to (count, list); |
459 } | 466 } |
460 | 467 |
461 syms_of_undo () | 468 syms_of_undo () |
462 { | 469 { |