aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-11 09:24:26 +0200
committerLars Ingebrigtsen2019-10-11 09:24:30 +0200
commit85b3d56276430d58c0a2444bb8dcff3155300278 (patch)
tree0efc4305dd12d89513d7d4e577a44ace72b362aa
parent49614ec8002c7b424a4d794b5e7491f0959280fd (diff)
downloademacs-85b3d56276430d58c0a2444bb8dcff3155300278.tar.gz
emacs-85b3d56276430d58c0a2444bb8dcff3155300278.zip
New variable amalgamating-undo-limit
* doc/lispref/text.texi (Undo): Document it. * lisp/simple.el (amalgamating-undo-limit): New variable (bug#31658).
-rw-r--r--doc/lispref/text.texi5
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/simple.el10
3 files changed, 18 insertions, 1 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index ef11ac26690..bf88477adbd 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -1399,6 +1399,7 @@ appropriate time.
1399 1399
1400@defun undo-auto-amalgamate 1400@defun undo-auto-amalgamate
1401@cindex amalgamating commands, and undo 1401@cindex amalgamating commands, and undo
1402@vindex amalgamating-undo-limit
1402The editor command loop automatically calls @code{undo-boundary} just 1403The editor command loop automatically calls @code{undo-boundary} just
1403before executing each key sequence, so that each undo normally undoes 1404before executing each key sequence, so that each undo normally undoes
1404the effects of one command. A few exceptional commands are 1405the effects of one command. A few exceptional commands are
@@ -1416,6 +1417,10 @@ will be called in each of the affected buffers.
1416This function can be called before an amalgamating command. It 1417This function can be called before an amalgamating command. It
1417removes the previous @code{undo-boundary} if a series of such calls 1418removes the previous @code{undo-boundary} if a series of such calls
1418have been made. 1419have been made.
1420
1421The maximum number of changes that can be amalgamated is controlled by
1422the @code{amalgamating-undo-limit} variable. If this variable is 1,
1423no changes are amalgamated.
1419@end defun 1424@end defun
1420 1425
1421@defvar undo-auto-current-boundary-timer 1426@defvar undo-auto-current-boundary-timer
diff --git a/etc/NEWS b/etc/NEWS
index 4135d47ee18..a3a7ff28e80 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -453,6 +453,10 @@ Note that this key binding will not work on MS-Windows systems if
453 453
454* Editing Changes in Emacs 27.1 454* Editing Changes in Emacs 27.1
455 455
456+++
457** The new 'amalgamating-undo-limit' variable can be used to control
458how many changes should be amalgamated when using the 'undo' command.
459
456--- 460---
457** The 'newline-and-indent' command (commonly bound to 'RET' in many 461** The 'newline-and-indent' command (commonly bound to 'RET' in many
458modes) now takes an optional numeric argument to specify how many 462modes) now takes an optional numeric argument to specify how many
diff --git a/lisp/simple.el b/lisp/simple.el
index b5205dd7648..597278ae2b4 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."
45 :group 'display 45 :group 'display
46 :version "22.1") 46 :version "22.1")
47 47
48(defvar amalgamating-undo-limit 20
49 "The maximum number of changes to possibly amalgamate when undoing changes.
50The `undo' command will normally consider \"similar\" changes
51(like inserting characters) to be part of the same change. This
52is called \"amalgamating\" the changes. This variable says what
53the maximum number of changes condidered is when amalgamating. A
54value of 1 means that nothing is amalgamated.")
55
48(defgroup killing nil 56(defgroup killing nil
49 "Killing and yanking commands." 57 "Killing and yanking commands."
50 :group 'editing) 58 :group 'editing)
@@ -3124,7 +3132,7 @@ behavior."
3124 (undo-auto--last-boundary-amalgamating-number))) 3132 (undo-auto--last-boundary-amalgamating-number)))
3125 (setq undo-auto--this-command-amalgamating t) 3133 (setq undo-auto--this-command-amalgamating t)
3126 (when last-amalgamating-count 3134 (when last-amalgamating-count
3127 (if (and (< last-amalgamating-count 20) 3135 (if (and (< last-amalgamating-count amalgamating-undo-limit)
3128 (eq this-command last-command)) 3136 (eq this-command last-command))
3129 ;; Amalgamate all buffers that have changed. 3137 ;; Amalgamate all buffers that have changed.
3130 ;; This may be needed for example if some *-change-functions 3138 ;; This may be needed for example if some *-change-functions