branch: externals/vundo commit 12862c673d274adab2b9232a281f64898016c3e4 Author: Campbell Barton <ideasma...@gmail.com> Commit: Yuan Fu <caso...@gmail.com>
Add vundo-save command Support saving the buffer at the current state while exploring history. * README.txt: Mention new command. * vundo.el (vundo-mode-map): Add new command. (vundo-save): New command. --- README.txt | 3 +++ vundo.el | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/README.txt b/README.txt index 4ae1dca8e2..5da688f33e 100644 --- a/README.txt +++ b/README.txt @@ -14,6 +14,9 @@ should pop up. To move around, type: q to quit, you can also type C-g + [remap save-buffer] + to save the buffer at the current undo state + n/p may need some more explanation. In the following tree, n/p can move between A and B because they share a parent (thus at a branching point), but not C and D. diff --git a/vundo.el b/vundo.el index 686ede4435..0ad10a566b 100644 --- a/vundo.el +++ b/vundo.el @@ -605,6 +605,8 @@ WINDOW is the window that was/is displaying the vundo buffer." (define-key map (kbd "RET") #'vundo-confirm) (define-key map (kbd "i") #'vundo--inspect) (define-key map (kbd "d") #'vundo--debug) + + (define-key map [remap save-buffer] #'vundo-save) map) "Keymap for `vundo-mode'.") @@ -1129,6 +1131,13 @@ If ARG < 0, move forward." vundo--orig-buffer (current-buffer) 'incremental)))) +(defun vundo-save (arg) + "Run `save-buffer' with the current buffer Vundo is operating on." + (interactive "p") + (vundo--check-for-command + (with-current-buffer vundo--orig-buffer + (save-buffer arg)))) + ;;; Debug (defun vundo--setup-test-buffer ()