emacs-diffs
[Top][All Lists]
Advanced

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

master 6fecf6e: Add bindings for 'undo-redo'


From: Dmitry Gutov
Subject: master 6fecf6e: Add bindings for 'undo-redo'
Date: Wed, 29 Sep 2021 16:04:42 -0400 (EDT)

branch: master
commit 6fecf6ef2552a9b44c4311b7d5af3af0a5a54dbe
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Add bindings for 'undo-redo'
    
    * etc/NEWS: Describe the change.
    
    * lisp/bindings.el (global-map): Add bindings for 'undo-redo'.
    
    * lisp/simple.el (undo-no-redo): Turn into a user option.
---
 etc/NEWS         | 6 +++++-
 lisp/bindings.el | 3 +++
 lisp/simple.el   | 5 +++--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 0a8249e..0c5a100 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -957,7 +957,11 @@ for CJK text mixed with Latin text.
 +++
 ** New command 'undo-redo'.
 It undoes previous undo commands, but doesn't record itself as an
-undoable command.
+undoable command.  It is bound to 'C-?' and 'C-M-_', the first binding
+works well in graphical mode, and the second one is easy to hit on tty.
+
+For full conventional undo/redo behavior, you can also customize the
+user option 'undo-no-redo' to t.
 
 +++
 ** New commands 'copy-matching-lines' and 'kill-matching-lines'.
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 343f1ba..9a35050 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -994,6 +994,9 @@ if `inhibit-field-text-motion' is non-nil."
   "Keymap to repeat undo key sequences `C-x u u'.  Used in `repeat-mode'.")
 (put 'undo 'repeat-map 'undo-repeat-map)
 
+(define-key global-map (kbd "C-?") 'undo-redo)
+(define-key global-map [?\C-\M-_] 'undo-redo)
+
 (define-key esc-map "!" 'shell-command)
 (define-key esc-map "|" 'shell-command-on-region)
 (define-key esc-map "&" 'async-shell-command)
diff --git a/lisp/simple.el b/lisp/simple.el
index dd48039..7eba331 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2942,8 +2942,9 @@ undo record: if we undo from 4, `pending-undo-list' will 
be at 3,
 (defvar undo-in-region nil
   "Non-nil if `pending-undo-list' is not just a tail of `buffer-undo-list'.")
 
-(defvar undo-no-redo nil
-  "If t, `undo' doesn't go through redo entries.")
+(defcustom undo-no-redo nil
+  "If t, `undo' doesn't go through redo entries."
+  :type 'boolean)
 
 (defvar pending-undo-list nil
   "Within a run of consecutive undo commands, list remaining to be undone.



reply via email to

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