diff options
| author | BardofSprites <[email protected]> | 2024-10-06 21:37:15 -0400 |
|---|---|---|
| committer | BardofSprites <[email protected]> | 2024-10-06 21:37:15 -0400 |
| commit | 9fc3eb1e96b8515a1e7685bfcb61bcd09674ab73 (patch) | |
| tree | 891ffe3a88502a48d4c4128ffd23960216afba06 /bard-emacs-modules | |
| parent | 2ed41d4fa3d399790368ee24b9087a40df2a0da1 (diff) | |
vundo
Diffstat (limited to 'bard-emacs-modules')
| -rw-r--r-- | bard-emacs-modules/bard-emacs-essentials.el | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bard-emacs-modules/bard-emacs-essentials.el b/bard-emacs-modules/bard-emacs-essentials.el index 79d8ea0..c64f271 100644 --- a/bard-emacs-modules/bard-emacs-essentials.el +++ b/bard-emacs-modules/bard-emacs-essentials.el @@ -147,6 +147,42 @@ :hook (prog-mode . breadcrumb-local-mode)) +(use-package vundo + :ensure t + :defer 1 + :bind + ( :map vundo-mode-map + ("C-/" . vundo-backward) + ("C-?" . vundo-forward) + ("g" . vundo-goto-last-saved) + ("p" . vundo-backward) + ("n" . vundo-forward) + ("f" . vundo-next) + ("b" . vundo-previous)) + :config + (setq vundo-glyph-alist vundo-unicode-symbols) + + (defvar prot/vundo-undo-functions '(undo undo-only undo-redo) + "List of undo functions to check if we need to visualise the undo ring.") + + (defvar prot/vundo-undo-command #'undo + "Command to call if we are not going to visualise the undo ring.") + + (defun prot/vundo-if-repeat-undo (&rest args) + "Use `vundo' if the last command is among `prot/vundo-undo-functions'. +In other words, start visualising the undo ring if we are going +to be cycling through the edits." + (interactive) + (if (and (member last-command prot/vundo-undo-functions) + (not undo-in-region)) + (call-interactively 'vundo) + (apply args))) + + (mapc + (lambda (fn) + (advice-add fn :around #'prot/vundo-if-repeat-undo)) + prot/vundo-undo-functions)) + ;; running emacs as server (require 'server) (setq server-client-instructions nil) |
