Commit 85b3d562 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen
Browse files

New variable amalgamating-undo-limit

* doc/lispref/text.texi (Undo): Document it.

* lisp/simple.el (amalgamating-undo-limit): New variable (bug#31658).
parent 49614ec8
Pipeline #3562 failed with stage
in 90 minutes and 4 seconds
......@@ -1399,6 +1399,7 @@ appropriate time.
@defun undo-auto-amalgamate
@cindex amalgamating commands, and undo
@vindex amalgamating-undo-limit
The editor command loop automatically calls @code{undo-boundary} just
before executing each key sequence, so that each undo normally undoes
the effects of one command. A few exceptional commands are
......@@ -1416,6 +1417,10 @@ will be called in each of the affected buffers.
This function can be called before an amalgamating command. It
removes the previous @code{undo-boundary} if a series of such calls
have been made.
The maximum number of changes that can be amalgamated is controlled by
the @code{amalgamating-undo-limit} variable. If this variable is 1,
no changes are amalgamated.
@end defun
@defvar undo-auto-current-boundary-timer
......@@ -453,6 +453,10 @@ Note that this key binding will not work on MS-Windows systems if
* Editing Changes in Emacs 27.1
** The new 'amalgamating-undo-limit' variable can be used to control
how many changes should be amalgamated when using the 'undo' command.
** The 'newline-and-indent' command (commonly bound to 'RET' in many
modes) now takes an optional numeric argument to specify how many
......@@ -45,6 +45,14 @@ wait this many seconds after Emacs becomes idle before doing an update."
:group 'display
:version "22.1")
(defvar amalgamating-undo-limit 20
"The maximum number of changes to possibly amalgamate when undoing changes.
The `undo' command will normally consider \"similar\" changes
(like inserting characters) to be part of the same change. This
is called \"amalgamating\" the changes. This variable says what
the maximum number of changes condidered is when amalgamating. A
value of 1 means that nothing is amalgamated.")
(defgroup killing nil
"Killing and yanking commands."
:group 'editing)
......@@ -3124,7 +3132,7 @@ behavior."
(setq undo-auto--this-command-amalgamating t)
(when last-amalgamating-count
(if (and (< last-amalgamating-count 20)
(if (and (< last-amalgamating-count amalgamating-undo-limit)
(eq this-command last-command))
;; Amalgamate all buffers that have changed.
;; This may be needed for example if some *-change-functions
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment