Closed ideasman42 closed 2 years ago
Thanks, merged. I changed the hook names to pre-enter-hook
and post-exit-hook
to indicate they runs at the very beginning and end.
Are these changes meant to be in master? (last commit was from ~17 days ago)
Yeah yeah, I merged and pushed locally and made a new version, but I was like "better address any possible follow ups before pushing a new version". So I'm waiting for all the conversations to settle before I push the updates.
Thanks, closing.
@ideasman42 Can you actually get hl-undo-mode to work with vundo like that (with the correct hook names)? I can't seem to get hl-undo-mode to work with vundo at all.
Also the documentation for vundo-post-exit-hook
still needs to be fixed ("entering" -> "exiting, "exists" -> "exits").
@noctuid yes, but it was a bit of a hassle as the pre-command hook needs to run in the text-buffer. Even though vundo commands are running int the vundo buffer.
(setq undo-hl-undo-commands
(list 'vundo-backward 'vundo-forward 'vundo-stem-root 'vundo-stem-end))
(defvar my-real-vundo-buf nil)
(defun my-vundo-forward-pre-command-hook ()
(let ((buf (current-buffer)))
(when (bound-and-true-p my-real-vundo-buf)
(unless (eq buf my-real-vundo-buf)
(with-current-buffer my-real-vundo-buf (run-hooks 'pre-command-hook))))))
(add-hook 'vundo-pre-enter-hook
(lambda ()
(setq my-real-vundo-buf (current-buffer))
(add-hook 'pre-command-hook 'my-vundo-forward-pre-command-hook)
(undo-hl-mode 1)))
(add-hook 'vundo-post-exit-hook
(lambda ()
(remove-hook 'pre-command-hook 'my-vundo-forward-pre-command-hook)
(undo-hl-mode -1)
(makunbound 'my-real-vundo-buf)))
This makes it possible to activate a minor mode while Vundo is in use.