branch: elpa/undo-fu
commit dbb3e4b699dd488497ef9b32a04b8e928a6bc8ef
Author: Campbell Barton <[email protected]>
Commit: Campbell Barton <[email protected]>
Add action to clear all undo history
Addresses #19.
---
changelog.rst | 3 +++
readme.rst | 1 +
undo-fu.el | 12 ++++++++++++
3 files changed, 16 insertions(+)
diff --git a/changelog.rst b/changelog.rst
index ae7c0ca86d..31ac4458a9 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -3,6 +3,9 @@
Change Log
##########
+- In development.
+ - Add ``undo-fu-clear-all`` to delete all undo history.
+
- Version 0.5 (2022-07-10)
- Fix unconstrained undo when the user has ``undo-no-redo`` enabled.
- Protect against ``aggressive-indent-mode``.
diff --git a/readme.rst b/readme.rst
index 57eaf0fc1b..473af8f234 100644
--- a/readme.rst
+++ b/readme.rst
@@ -40,6 +40,7 @@ This package exposes the following functions:
- ``undo-fu-only-redo``
- ``undo-fu-only-redo-all``
- ``undo-fu-disable-checkpoint`` (only needed when
``undo-fu-ignore-keyboard-quit`` is in use).
+- ``undo-fu-clear-all`` clear all undo/redo history.
Key Bindings
diff --git a/undo-fu.el b/undo-fu.el
index b6dd528fbd..0afe83a078 100644
--- a/undo-fu.el
+++ b/undo-fu.el
@@ -428,6 +428,18 @@ Optional argument ARG the number of steps to undo."
(setq this-command 'undo-fu-only-undo)
success)))
+;; ---------------------------------------------------------------------------
+;; Public Functions (Extra Utilities)
+
+;;;###autoload
+(defun undo-fu-clear-all ()
+ "Clear all undo/redo steps."
+ (interactive)
+ (setq buffer-undo-list nil)
+ (setq pending-undo-list nil)
+ (clrhash undo-equiv-table))
+
+
;; Evil Mode (setup if in use)
;;
;; Don't let these commands repeat.