+
+ DEFVAR_INT ("undo-limit", &undo_limit,
+ doc: /* Keep no more undo information once it exceeds this size.
+This limit is applied when garbage collection happens.
+When a previous command increases the total undo list size past this
+value, the earlier commands that came before it are forgotten.
+
+The size is counted as the number of bytes occupied,
+which includes both saved text and other data. */);
+ undo_limit = 20000;
+
+ DEFVAR_INT ("undo-strong-limit", &undo_strong_limit,
+ doc: /* Don't keep more than this much size of undo information.
+This limit is applied when garbage collection happens.
+When a previous command increases the total undo list size past this
+value, that command and the earlier commands that came before it are forgotten.
+However, the most recent buffer-modifying command's undo info
+is never discarded for this reason.
+
+The size is counted as the number of bytes occupied,
+which includes both saved text and other data. */);
+ undo_strong_limit = 30000;
+
+ DEFVAR_LISP ("undo-outer-limit", &Vundo_outer_limit,
+ doc: /* Outer limit on size of undo information for one command.
+At garbage collection time, if the current command has produced
+more than this much undo information, it discards the info and displays
+a warning. This is a last-ditch limit to prevent memory overflow.
+
+The size is counted as the number of bytes occupied, which includes
+both saved text and other data. A value of nil means no limit. In
+this case, accumulating one huge undo entry could make Emacs crash as
+a result of memory overflow.
+
+In fact, this calls the function which is the value of
+`undo-outer-limit-function' with one argument, the size.
+The text above describes the behavior of the function
+that variable usually specifies. */);
+ Vundo_outer_limit = make_number (3000000);
+
+ DEFVAR_LISP ("undo-outer-limit-function", &Vundo_outer_limit_function,
+ doc: /* Function to call when an undo list exceeds `undo-outer-limit'.
+This function is called with one argument, the current undo list size
+for the most recent command (since the last undo boundary).
+If the function returns t, that means truncation has been fully handled.
+If it returns nil, the other forms of truncation are done.
+
+Garbage collection is inhibited around the call to this function,
+so it must make sure not to do a lot of consing. */);
+ Vundo_outer_limit_function = Qnil;