]> git.eshelyaron.com Git - emacs.git/commitdiff
New variable amalgamating-undo-limit
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 11 Oct 2019 07:24:26 +0000 (09:24 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 11 Oct 2019 07:24:30 +0000 (09:24 +0200)
* doc/lispref/text.texi (Undo): Document it.

* lisp/simple.el (amalgamating-undo-limit): New variable (bug#31658).

doc/lispref/text.texi
etc/NEWS
lisp/simple.el

index ef11ac26690860c7a1aa8a368c65293f27fb4cfa..bf88477adbd402d1c606843a5fd4902df5333569 100644 (file)
@@ -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
index 4135d47ee18a34e0920ef99a95e16d8080457e3c..a3a7ff28e807c029a49292eb08653a3ae19c3294 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -453,6 +453,10 @@ Note that this key binding will not work on MS-Windows systems if
 \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
index b5205dd76483179d1fdc301d9401852b61b9f511..597278ae2b4d9f4377f5287f5e20486ae137202c 100644 (file)
@@ -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."
          (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