emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 85b3d56: New variable amalgamating-undo-limit


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 85b3d56: New variable amalgamating-undo-limit
Date: Fri, 11 Oct 2019 03:24:37 -0400 (EDT)

branch: master
commit 85b3d56276430d58c0a2444bb8dcff3155300278
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    New variable amalgamating-undo-limit
    
    * doc/lispref/text.texi (Undo): Document it.
    
    * lisp/simple.el (amalgamating-undo-limit): New variable (bug#31658).
---
 doc/lispref/text.texi |  5 +++++
 etc/NEWS              |  4 ++++
 lisp/simple.el        | 10 +++++++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index ef11ac2..bf88477 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -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
diff --git a/etc/NEWS b/etc/NEWS
index 4135d47..a3a7ff2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
diff --git a/lisp/simple.el b/lisp/simple.el
index b5205dd..597278a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]