diff --git a/etc/NEWS b/etc/NEWS index 8f20db7a76..4e12d431a1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -865,7 +865,13 @@ 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 bind undo-only: + + (define-key global-map [?\C-/] 'undo-only) + (define-key global-map "\C-_" 'undo-only) +++ ** New commands 'copy-matching-lines' and 'kill-matching-lines'. diff --git a/lisp/bindings.el b/lisp/bindings.el index b8bf0c1a6f..97a7b01d43 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -993,6 +993,9 @@ undo-repeat-map "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)