diff options
Diffstat (limited to 'devdocs/elisp/maintaining-undo.html')
| -rw-r--r-- | devdocs/elisp/maintaining-undo.html | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/devdocs/elisp/maintaining-undo.html b/devdocs/elisp/maintaining-undo.html new file mode 100644 index 00000000..b88ae40e --- /dev/null +++ b/devdocs/elisp/maintaining-undo.html @@ -0,0 +1,24 @@ + <h3 class="section">Maintaining Undo Lists</h3> <p>This section describes how to enable and disable undo information for a given buffer. It also explains how the undo list is truncated automatically so it doesn’t get too big. </p> <p>Recording of undo information in a newly created buffer is normally enabled to start with; but if the buffer name starts with a space, the undo recording is initially disabled. You can explicitly enable or disable undo recording with the following two functions, or by setting <code>buffer-undo-list</code> yourself. </p> <dl> <dt id="buffer-enable-undo">Command: <strong>buffer-enable-undo</strong> <em>&optional buffer-or-name</em> +</dt> <dd> +<p>This command enables recording undo information for buffer <var>buffer-or-name</var>, so that subsequent changes can be undone. If no argument is supplied, then the current buffer is used. This function does nothing if undo recording is already enabled in the buffer. It returns <code>nil</code>. </p> <p>In an interactive call, <var>buffer-or-name</var> is the current buffer. You cannot specify any other buffer. </p> +</dd> +</dl> <dl> <dt id="buffer-disable-undo">Command: <strong>buffer-disable-undo</strong> <em>&optional buffer-or-name</em> +</dt> <dd> + <p>This function discards the undo list of <var>buffer-or-name</var>, and disables further recording of undo information. As a result, it is no longer possible to undo either previous changes or any subsequent changes. If the undo list of <var>buffer-or-name</var> is already disabled, this function has no effect. </p> <p>In an interactive call, BUFFER-OR-NAME is the current buffer. You cannot specify any other buffer. This function returns <code>nil</code>. </p> +</dd> +</dl> <p>As editing continues, undo lists get longer and longer. To prevent them from using up all available memory space, garbage collection trims them back to size limits you can set. (For this purpose, the size of an undo list measures the cons cells that make up the list, plus the strings of deleted text.) Three variables control the range of acceptable sizes: <code>undo-limit</code>, <code>undo-strong-limit</code> and <code>undo-outer-limit</code>. In these variables, size is counted as the number of bytes occupied, which includes both saved text and other data. </p> <dl> <dt id="undo-limit">User Option: <strong>undo-limit</strong> +</dt> <dd><p>This is the soft limit for the acceptable size of an undo list. The change group at which this size is exceeded is the last one kept. </p></dd> +</dl> <dl> <dt id="undo-strong-limit">User Option: <strong>undo-strong-limit</strong> +</dt> <dd><p>This is the upper limit for the acceptable size of an undo list. The change group at which this size is exceeded is discarded itself (along with all older change groups). There is one exception: the very latest change group is only discarded if it exceeds <code>undo-outer-limit</code>. </p></dd> +</dl> <dl> <dt id="undo-outer-limit">User Option: <strong>undo-outer-limit</strong> +</dt> <dd><p>If at garbage collection time the undo info for the current command exceeds this limit, Emacs discards the info and displays a warning. This is a last ditch limit to prevent memory overflow. </p></dd> +</dl> <dl> <dt id="undo-ask-before-discard">User Option: <strong>undo-ask-before-discard</strong> +</dt> <dd> +<p>If this variable is non-<code>nil</code>, when the undo info exceeds <code>undo-outer-limit</code>, Emacs asks in the echo area whether to discard the info. The default value is <code>nil</code>, which means to discard it automatically. </p> <p>This option is mainly intended for debugging. Garbage collection is inhibited while the question is asked, which means that Emacs might leak memory if the user waits too long before answering the question. </p> +</dd> +</dl><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Maintaining-Undo.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Maintaining-Undo.html</a> + </p> +</div> |
