aboutsummaryrefslogtreecommitdiffstats
path: root/src/undo.c
diff options
context:
space:
mode:
authorMiles Bader2005-02-02 01:54:00 +0000
committerMiles Bader2005-02-02 01:54:00 +0000
commitf3d3402885646e6fa79f1ad59fb8a1f9017851d7 (patch)
tree0d381cd0e2eb41edd55d4473bcaaab4053e69468 /src/undo.c
parent0d2e792ea9c1a983937e016f7f97cc64f2013603 (diff)
parentf2433a30c5c6fa307ae1358c15e65e484989e5b4 (diff)
downloademacs-f3d3402885646e6fa79f1ad59fb8a1f9017851d7.tar.gz
emacs-f3d3402885646e6fa79f1ad59fb8a1f9017851d7.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-10
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-59 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-68 Update from CVS
Diffstat (limited to 'src/undo.c')
-rw-r--r--src/undo.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/src/undo.c b/src/undo.c
index df4b8d08cd6..ea4f35397a9 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -40,6 +40,10 @@ Lisp_Object last_undo_buffer;
40 40
41Lisp_Object Qinhibit_read_only; 41Lisp_Object Qinhibit_read_only;
42 42
43/* Marker for function call undo list elements. */
44
45Lisp_Object Qapply;
46
43/* The first time a command records something for undo. 47/* The first time a command records something for undo.
44 it also allocates the undo-boundary object 48 it also allocates the undo-boundary object
45 which will be added to the list at the end of the command. 49 which will be added to the list at the end of the command.
@@ -519,7 +523,7 @@ Return what remains of the list. */)
519 } 523 }
520 else if (EQ (car, Qnil)) 524 else if (EQ (car, Qnil))
521 { 525 {
522 /* Element (nil prop val beg . end) is property change. */ 526 /* Element (nil PROP VAL BEG . END) is property change. */
523 Lisp_Object beg, end, prop, val; 527 Lisp_Object beg, end, prop, val;
524 528
525 prop = Fcar (cdr); 529 prop = Fcar (cdr);
@@ -543,6 +547,26 @@ Return what remains of the list. */)
543 Fgoto_char (car); 547 Fgoto_char (car);
544 Fdelete_region (car, cdr); 548 Fdelete_region (car, cdr);
545 } 549 }
550 else if (EQ (car, Qapply))
551 {
552 Lisp_Object oldlist = current_buffer->undo_list;
553 /* Element (apply FUNNAME . ARGS) means call FUNNAME to undo. */
554 car = Fcar (cdr);
555 if (INTEGERP (car))
556 {
557 /* Long format: (apply DELTA START END FUNNAME . ARGS). */
558 cdr = Fcdr (Fcdr (Fcdr (cdr)));
559 car = Fcar (cdr);
560 }
561 cdr = Fcdr (cdr);
562 apply1 (car, cdr);
563 /* Make sure this produces at least one undo entry,
564 so the test in `undo' for continuing an undo series
565 will work right. */
566 if (EQ (oldlist, current_buffer->undo_list))
567 current_buffer->undo_list
568 = Fcons (list2 (Qcdr, Qnil), current_buffer->undo_list);
569 }
546 else if (STRINGP (car) && INTEGERP (cdr)) 570 else if (STRINGP (car) && INTEGERP (cdr))
547 { 571 {
548 /* Element (STRING . POS) means STRING was deleted. */ 572 /* Element (STRING . POS) means STRING was deleted. */
@@ -589,13 +613,16 @@ Return what remains of the list. */)
589 UNGCPRO; 613 UNGCPRO;
590 return unbind_to (count, list); 614 return unbind_to (count, list);
591} 615}
592 616
593void 617void
594syms_of_undo () 618syms_of_undo ()
595{ 619{
596 Qinhibit_read_only = intern ("inhibit-read-only"); 620 Qinhibit_read_only = intern ("inhibit-read-only");
597 staticpro (&Qinhibit_read_only); 621 staticpro (&Qinhibit_read_only);
598 622
623 Qapply = intern ("apply");
624 staticpro (&Qapply);
625
599 pending_boundary = Qnil; 626 pending_boundary = Qnil;
600 staticpro (&pending_boundary); 627 staticpro (&pending_boundary);
601 628
@@ -627,17 +654,19 @@ which includes both saved text and other data. */);
627 DEFVAR_LISP ("undo-outer-limit", &Vundo_outer_limit, 654 DEFVAR_LISP ("undo-outer-limit", &Vundo_outer_limit,
628 doc: /* Outer limit on size of undo information for one command. 655 doc: /* Outer limit on size of undo information for one command.
629At garbage collection time, if the current command has produced 656At garbage collection time, if the current command has produced
630more than this much undo information, it asks you whether to delete 657more than this much undo information, it discards the info and displays
631the information. This is a last-ditch limit to prevent memory overflow. 658a warning. This is a last-ditch limit to prevent memory overflow.
632 659
633The size is counted as the number of bytes occupied, 660The size is counted as the number of bytes occupied, which includes
634which includes both saved text and other data. 661both saved text and other data. A value of nil means no limit. In
662this case, accumulating one huge undo entry could make Emacs crash as
663a result of memory overflow.
635 664
636In fact, this calls the function which is the value of 665In fact, this calls the function which is the value of
637`undo-outer-limit-function' with one argument, the size. 666`undo-outer-limit-function' with one argument, the size.
638The text above describes the behavior of the function 667The text above describes the behavior of the function
639that variable usually specifies. */); 668that variable usually specifies. */);
640 Vundo_outer_limit = make_number (300000); 669 Vundo_outer_limit = make_number (3000000);
641 670
642 DEFVAR_LISP ("undo-outer-limit-function", &Vundo_outer_limit_function, 671 DEFVAR_LISP ("undo-outer-limit-function", &Vundo_outer_limit_function,
643 doc: /* Function to call when an undo list exceeds `undo-outer-limit'. 672 doc: /* Function to call when an undo list exceeds `undo-outer-limit'.