Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add special hook vundo-after-undo-functions #74

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions vundo.el
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,11 @@ the INCREMENTAL option in `vundo--refresh-buffer' anymore."
(message "Trimmed to: %s"
(vundo-m-idx possible-trim-point))))))

(defvar vundo-after-undo-functions nil
"Special hook that runs after `vundo' motions.
Functions aasigned to this hook are called with one argument: the
original buffer `vundo' operates on.")

(defun vundo-forward (arg)
"Move forward ARG nodes in the undo tree.
If ARG < 0, move backward."
Expand Down Expand Up @@ -1145,7 +1150,8 @@ If ARG < 0, move backward."
vundo--orig-buffer dest vundo--prev-mod-list)
;; Refresh display.
(vundo--refresh-buffer
vundo--orig-buffer (current-buffer) 'incremental))))))
vundo--orig-buffer (current-buffer) 'incremental))))
(run-hook-with-args 'vundo-after-undo-functions vundo--orig-buffer)))

(defun vundo-backward (arg)
"Move back ARG nodes in the undo tree.
Expand Down Expand Up @@ -1175,7 +1181,8 @@ If ARG < 0, move forward."
vundo--orig-buffer dest vundo--prev-mod-list)
(vundo--refresh-buffer
vundo--orig-buffer (current-buffer)
'incremental)))))))
'incremental)))))
(run-hook-with-args 'vundo-after-undo-functions vundo--orig-buffer)))

(defun vundo-previous (arg)
"Move to node above the current one. Move ARG steps."
Expand Down