vundo: add diff display

This commit is contained in:
MitchMarq42 2023-03-13 14:45:59 -08:00
parent 7b4485ef10
commit a0dc40fe24

View File

@ -184,7 +184,29 @@
:if (< (string-to-number emacs-version) 28) :if (< (string-to-number emacs-version) 28)
:diminish) :diminish)
(use-package vundo (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 (use-package evil-goggles
:diminish :diminish
:after evil :after evil