* doc/lispref/text.texi (Undo): Document it.
* lisp/simple.el (amalgamating-undo-limit): New variable (bug#31658).
@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
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
\f
* 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
: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)
(undo-auto--last-boundary-amalgamating-number)))
(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