-
Notifications
You must be signed in to change notification settings - Fork 23
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
Conversation
The idea is to allow users to call functions that act on the vundo--orig-buffer.
I am using this special hook to produce a diff of the underlying file. Here is how I am doing it right now: (defvar prot/vundo-diff-buffer-window nil
"Window object of `prot/vundo-diff-buffer'.")
(defun prot/vundo-quit-diff-window ()
"Quit `prot/vundo-diff-buffer-window' if it is live.
Assign this function to the `vundo-post-exit-hook'."
(when (and prot/vundo-diff-buffer-window
(window-live-p prot/vundo-diff-buffer-window))
(quit-window nil prot/vundo-diff-buffer-window)
(setq prot/vundo-diff-buffer-window nil)))
(defun prot/vundo-diff-buffer (buffer)
"Diff BUFFER with its underlying file, if possible.
Assign this to `vundo-after-undo-functions'. BUFFER is provided
by that special hook."
(when (buffer-file-name buffer)
(with-current-buffer (window-buffer (diff-buffer-with-file buffer))
(setq prot/vundo-diff-buffer-window (get-buffer-window)))))
(add-hook 'vundo-after-undo-functions #'prot/vundo-diff-buffer)
(add-hook 'vundo-post-exit-hook #'prot/vundo-quit-diff-window) |
I am waiting for upstream to respond to my pull request: <casouri/vundo#74>.
hi guys :). wonder if we can select two points in vundo and construct a diff between them? |
Cool. I think this is fine. I'd call hooks |
Thank you @casouri!
Quote from
|
Thanks, TIL. I merged the change. |
@gitrj95 You can move between nodes on the tree with To be extra save you can clone the original buffer first. |
My pull request was merged and now I can use upstream vundo to perform the diff I want: <casouri/vundo#74>.
@gitrj95 It's very possible to a "mark and diff", and we should definitely add this option. Can reuse some of the marking functionality from the saved buffer state improvements. In fact, I use a |
The idea is to allow users to call functions that act on the vundo--orig-buffer.