Mercurial > hg > xemacs-beta
comparison src/undo.c @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | 74fd4e045ea6 |
children | 11054d720c21 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
44 /* The first time a command records something for undo. | 44 /* The first time a command records something for undo. |
45 it also allocates the undo-boundary object | 45 it also allocates the undo-boundary object |
46 which will be added to the list at the end of the command. | 46 which will be added to the list at the end of the command. |
47 This ensures we can't run out of space while trying to make | 47 This ensures we can't run out of space while trying to make |
48 an undo-boundary. */ | 48 an undo-boundary. */ |
49 static Lisp_Object pending_boundary; | 49 Lisp_Object pending_boundary; |
50 | 50 |
51 static void | 51 static void |
52 undo_boundary (struct buffer *b) | 52 undo_boundary (struct buffer *b) |
53 { | 53 { |
54 Lisp_Object tem = Fcar (b->undo_list); | 54 Lisp_Object tem = Fcar (b->undo_list); |
279 If the first element is an undo boundary, skip past it. */ | 279 If the first element is an undo boundary, skip past it. */ |
280 if (CONSP (next) | 280 if (CONSP (next) |
281 && NILP (XCAR (next))) | 281 && NILP (XCAR (next))) |
282 { | 282 { |
283 /* Add in the space occupied by this element and its chain link. */ | 283 /* Add in the space occupied by this element and its chain link. */ |
284 size_so_far += sizeof (Lisp_Cons); | 284 size_so_far += sizeof (struct Lisp_Cons); |
285 | 285 |
286 /* Advance to next element. */ | 286 /* Advance to next element. */ |
287 prev = next; | 287 prev = next; |
288 next = XCDR (next); | 288 next = XCDR (next); |
289 } | 289 } |
292 { | 292 { |
293 Lisp_Object elt; | 293 Lisp_Object elt; |
294 elt = XCAR (next); | 294 elt = XCAR (next); |
295 | 295 |
296 /* Add in the space occupied by this element and its chain link. */ | 296 /* Add in the space occupied by this element and its chain link. */ |
297 size_so_far += sizeof (Lisp_Cons); | 297 size_so_far += sizeof (struct Lisp_Cons); |
298 if (CONSP (elt)) | 298 if (CONSP (elt)) |
299 { | 299 { |
300 size_so_far += sizeof (Lisp_Cons); | 300 size_so_far += sizeof (struct Lisp_Cons); |
301 if (STRINGP (XCAR (elt))) | 301 if (STRINGP (XCAR (elt))) |
302 size_so_far += (sizeof (Lisp_String) - 1 | 302 size_so_far += (sizeof (struct Lisp_String) - 1 |
303 + XSTRING_LENGTH (XCAR (elt))); | 303 + XSTRING_LENGTH (XCAR (elt))); |
304 } | 304 } |
305 | 305 |
306 /* Advance to next element. */ | 306 /* Advance to next element. */ |
307 prev = next; | 307 prev = next; |
327 if (size_so_far > minsize && minsize > 0) | 327 if (size_so_far > minsize && minsize > 0) |
328 break; | 328 break; |
329 } | 329 } |
330 | 330 |
331 /* Add in the space occupied by this element and its chain link. */ | 331 /* Add in the space occupied by this element and its chain link. */ |
332 size_so_far += sizeof (Lisp_Cons); | 332 size_so_far += sizeof (struct Lisp_Cons); |
333 if (CONSP (elt)) | 333 if (CONSP (elt)) |
334 { | 334 { |
335 size_so_far += sizeof (Lisp_Cons); | 335 size_so_far += sizeof (struct Lisp_Cons); |
336 if (STRINGP (XCAR (elt))) | 336 if (STRINGP (XCAR (elt))) |
337 size_so_far += (sizeof (Lisp_String) - 1 | 337 size_so_far += (sizeof (struct Lisp_String) - 1 |
338 + XSTRING_LENGTH (XCAR (elt))); | 338 + XSTRING_LENGTH (XCAR (elt))); |
339 } | 339 } |
340 | 340 |
341 /* Advance to next element. */ | 341 /* Advance to next element. */ |
342 prev = next; | 342 prev = next; |
545 DEFSUBR (Fundo_boundary); | 545 DEFSUBR (Fundo_boundary); |
546 defsymbol (&Qinhibit_read_only, "inhibit-read-only"); | 546 defsymbol (&Qinhibit_read_only, "inhibit-read-only"); |
547 } | 547 } |
548 | 548 |
549 void | 549 void |
550 reinit_vars_of_undo (void) | 550 vars_of_undo (void) |
551 { | 551 { |
552 inside_undo = 0; | 552 inside_undo = 0; |
553 } | |
554 | |
555 void | |
556 vars_of_undo (void) | |
557 { | |
558 reinit_vars_of_undo (); | |
559 | |
560 pending_boundary = Qnil; | 553 pending_boundary = Qnil; |
561 staticpro (&pending_boundary); | 554 staticpro (&pending_boundary); |
562 last_undo_buffer = Qnil; | 555 last_undo_buffer = Qnil; |
563 staticpro (&last_undo_buffer); | 556 staticpro (&last_undo_buffer); |
564 } | 557 } |