branch: externals/vundo commit cf440667b4ece07a74e68dc84f029779f1ddfc24 Author: Yuan Fu <caso...@gmail.com> Commit: Yuan Fu <caso...@gmail.com>
Fix circular dependency (issue#104) * vundo-diff.el (vundo-diff--quit): Fix indentation. (vundo-diff): Use vundo-post-exit-hook to run vundo-diff--quit. * vundo.el: Don't require vundo-diff.el. --- vundo-diff.el | 5 ++++- vundo.el | 4 ---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/vundo-diff.el b/vundo-diff.el index ffbc153195..aca54cdf7c 100644 --- a/vundo-diff.el +++ b/vundo-diff.el @@ -132,7 +132,7 @@ NODE defaults to the current node." (defun vundo-diff--quit () "Quit the `vundo-diff' window and possibly kill buffer." (let* ((buf (get-buffer (concat "*vundo-diff-" (buffer-name) "*"))) - (win (and buf (get-buffer-window buf))) + (win (and buf (get-buffer-window buf))) (kill (eq vundo-diff-quit 'kill))) (if win (quit-window kill win) (when (and buf kill) (kill-buffer buf))))) @@ -143,6 +143,9 @@ NODE defaults to the current node." Displays in a separate diff buffer with name based on the original buffer name." (interactive) + ;; We can’t add this hook locally, because the hook runs in the + ;; original buffer. + (add-hook 'vundo-post-exit-hook #'vundo-diff--quit 0) (let* ((orig vundo--orig-buffer) (oname (buffer-name orig)) (current (vundo--current-node vundo--prev-mod-list)) diff --git a/vundo.el b/vundo.el index 45ebc39a37..c22c31715c 100644 --- a/vundo.el +++ b/vundo.el @@ -161,7 +161,6 @@ (require 'cl-lib) (require 'seq) (require 'subr-x) -(require 'vundo-diff) ;;; Customization @@ -746,7 +745,6 @@ WINDOW is the window that was/is displaying the vundo buffer." (declare-function vundo-diff "vundo-diff") (declare-function vundo-diff-mark "vundo-diff") (declare-function vundo-diff-unmark "vundo-diff") -(declare-function vundo-diff--quit "vundo-diff") (defvar vundo-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "f") #'vundo-forward) @@ -1030,7 +1028,6 @@ Roll back changes if `vundo-roll-back-on-quit' is non-nil." (when (window-live-p orig-window) (select-window orig-window)) (with-current-buffer orig-buffer - (vundo-diff--quit) (run-hooks 'vundo-post-exit-hook))))) (defun vundo-confirm () @@ -1044,7 +1041,6 @@ Roll back changes if `vundo-roll-back-on-quit' is non-nil." (when (window-live-p orig-window) (select-window orig-window)) (with-current-buffer orig-buffer - (vundo-diff--quit) (run-hooks 'vundo-post-exit-hook)))) ;;; Traverse undo tree