From a0dc40fe24da5fb1a5b5cdf4753470ae20103de7 Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Mon, 13 Mar 2023 14:45:59 -0800 Subject: [PATCH] vundo: add diff display --- lisp/mitch-packages.el | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lisp/mitch-packages.el b/lisp/mitch-packages.el index 166bcc6..0575f23 100644 --- a/lisp/mitch-packages.el +++ b/lisp/mitch-packages.el @@ -184,7 +184,29 @@ :if (< (string-to-number emacs-version) 28) :diminish) (use-package vundo - :custom (vundo-glyph-alist vundo-unicode-symbols)) + :custom (vundo-glyph-alist vundo-unicode-symbols) + :config + ;; taken from https://github.com/casouri/vundo/issues/56 + (defun my/vundo-diff () + (interactive) + (let* ((orig vundo--orig-buffer) + (source (vundo--current-node vundo--prev-mod-list)) + (dest (vundo-m-parent source))) + (if (or (not dest) (eq source dest)) + (message "vundo diff not available.") + (let ((buf (make-temp-name (concat (buffer-name orig) "-vundo-diff")))) + (vundo--move-to-node source dest orig vundo--prev-mod-list) + (with-current-buffer (get-buffer-create buf) + (insert-buffer orig)) + (vundo--refresh-buffer orig (current-buffer) 'incremental) + (vundo--move-to-node dest source orig vundo--prev-mod-list) + (vundo--refresh-buffer orig (current-buffer) 'incremental) + (diff-buffers buf orig) + (kill-buffer buf))))) + :general + (general-define-key + :keymaps 'vundo-mode-map + "d" 'my/vundo-diff)) (use-package evil-goggles :diminish :after evil