Skip to content

Commit 32df058

Browse files
committed
prot-emacs-git: add vundo temporary setup
I am waiting for upstream to respond to my pull request: <casouri/vundo#74>.
1 parent 32bc2e3 commit 32df058

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

emacs/.emacs.d/prot-emacs-modules/prot-emacs-git.el

+31
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,35 @@
195195

196196
(define-key global-map (kbd "C-c g") #'magit-status))
197197

198+
(prot-emacs-package vundo
199+
;; Waiting for my changes to be merged:
200+
;; <https://github.com/casouri/vundo/pull/74>.
201+
(:install "https://github.com/protesilaos/vundo/")
202+
(:delay 30)
203+
(setq vundo-glyph-alist vundo-unicode-symbols)
204+
205+
(define-key global-map (kbd "C-?") #'vundo) ; override `undo-redo'
206+
207+
(defvar prot/vundo-diff-buffer-window nil
208+
"Window object of `prot/vundo-diff-buffer'.")
209+
210+
(defun prot/vundo-quit-diff-window ()
211+
"Quit `prot/vundo-diff-buffer-window' if it is live.
212+
Assign this function to the `vundo-post-exit-hook'."
213+
(when (and prot/vundo-diff-buffer-window
214+
(window-live-p prot/vundo-diff-buffer-window))
215+
(quit-window nil prot/vundo-diff-buffer-window)
216+
(setq prot/vundo-diff-buffer-window nil)))
217+
218+
(defun prot/vundo-diff-buffer (buffer)
219+
"Diff BUFFER with its underlying file, if possible.
220+
Assign this to `vundo-after-undo-functions'. BUFFER is provided
221+
by that special hook."
222+
(when (buffer-file-name buffer)
223+
(with-current-buffer (window-buffer (diff-buffer-with-file buffer))
224+
(setq prot/vundo-diff-buffer-window (get-buffer-window)))))
225+
226+
(add-hook 'vundo-after-undo-functions #'prot/vundo-diff-buffer)
227+
(add-hook 'vundo-post-exit-hook #'prot/vundo-quit-diff-window))
228+
198229
(provide 'prot-emacs-git)

0 commit comments

Comments
 (0)