emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/ergoemacs-mode d7b86f6 279/325: Add urgoemacs-redo that


From: Stefan Monnier
Subject: [elpa] externals/ergoemacs-mode d7b86f6 279/325: Add urgoemacs-redo that requires undo-fu or emacs 28
Date: Sat, 23 Oct 2021 18:49:11 -0400 (EDT)

branch: externals/ergoemacs-mode
commit d7b86f67887c19e2c693cd0919df7404732dbce7
Author: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Commit: Matthew Fidler <514778+mattfidler@users.noreply.github.com>

    Add urgoemacs-redo that requires undo-fu or emacs 28
---
 ergoemacs-functions.el | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index f50662e..c8ebaee 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -108,13 +108,24 @@
 
 ;;;###autoload
 (defun ergoemacs-undo ()
-  "Run `undo'.  If in calc-mode, run `calc-undo'"
+  "Run `undo'. Prefer running undo-fo if present"
   (interactive)
-  (if (eq major-mode 'calc-mode)
-      (calc-undo 1)
-    (undo)
-    )
-  )
+  (cond
+   ((eq major-mode 'calc-mode)
+    (calc-undo 1))
+   ((fboundp 'undo-fu-only-undo)
+    (call-interactively ''undo-fu-only-undo))
+   (t (undo))))
+
+(defun ergoemacs-redo()
+  "Run `redo' when present."
+  (interactive)
+  (cond
+   ((fboundp 'undo-fu-only-redo)
+    (call-interactively ''undo-fu-only-redo))
+   ((fboundp 'undo-redo) ; should be in emacs 28
+    (call-interactively 'undo-redo))
+   (t (message "Redo support not present.  Try `undo-fu'"))))
 
 (defvar ergoemacs-revert-buffer 0)
 (defun ergoemacs-revert-buffer ()



reply via email to

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