[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vundo 7c64a07705 5/7: Merge branch 'pr-enter-exit-hooks
From: |
ELPA Syncer |
Subject: |
[elpa] externals/vundo 7c64a07705 5/7: Merge branch 'pr-enter-exit-hooks' |
Date: |
Sun, 24 Apr 2022 18:57:53 -0400 (EDT) |
branch: externals/vundo
commit 7c64a077055d61cbdc8f698154f5283c307c8bbc
Merge: fd780553f3 5718b635e9
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Merge branch 'pr-enter-exit-hooks'
---
vundo.el | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/vundo.el b/vundo.el
index 787f0f1918..7ab9b3c29a 100644
--- a/vundo.el
+++ b/vundo.el
@@ -253,6 +253,18 @@ characters."
:value-type (character :tag "Draw using")
:options ,(mapcar #'car vundo-unicode-symbols)))
+(defcustom vundo-pre-enter-hook nil
+ "List of functions to call when entering vundo.
+This hook runs immediately after ‘vundo’ is called, in the buffer
+the user invoked ‘vundo’, before every setup ‘vundo’ does."
+ :type 'hook)
+
+(defcustom vundo-post-exit-hook nil
+ "List of functions to call when entering vundo.
+This hook runs after every clean up the exiting function does.
+Ie, it is the very last thing that happens when vundo exists."
+ :type 'hook)
+
;;; Undo list to mod list
(cl-defstruct vundo-m
@@ -732,6 +744,7 @@ This function modifies ‘vundo--prev-mod-list’,
(interactive)
(when (not (consp buffer-undo-list))
(user-error "There is no undo history"))
+ (run-hooks 'vundo-pre-enter-hook)
(let ((vundo-buf (vundo-1 (current-buffer))))
(select-window
(display-buffer-in-side-window
@@ -805,14 +818,20 @@ Roll back changes if `vundo-roll-back-on-quit' is
non-nil."
vundo--orig-buffer vundo--prev-mod-list))
(with-current-buffer vundo--orig-buffer
(setq-local buffer-read-only nil))
- (kill-buffer-and-window)))
+ (let ((orig-buffer vundo--orig-buffer))
+ (kill-buffer-and-window)
+ (with-current-buffer orig-buffer
+ (run-hooks 'vundo-post-exit-hook)))))
(defun vundo-confirm ()
"Confirm change and close vundo window."
(interactive)
(with-current-buffer vundo--orig-buffer
(setq-local buffer-read-only nil))
- (kill-buffer-and-window))
+ (let ((orig-buffer vundo--orig-buffer))
+ (kill-buffer-and-window)
+ (with-current-buffer orig-buffer
+ (run-hooks 'vundo-post-exit-hook))))
;;; Traverse undo tree
- [elpa] externals/vundo updated (377194b705 -> 10d5debe31), ELPA Syncer, 2022/04/24
- [elpa] externals/vundo 115b9612b0 2/7: Rename vundo--window-max-height to avoid the double-dash, ELPA Syncer, 2022/04/24
- [elpa] externals/vundo 5718b635e9 4/7: Add hooks for entering and exiting vundo, ELPA Syncer, 2022/04/24
- [elpa] externals/vundo 401375c3f5 1/7: * vundo.el: Fix typos in commentary., ELPA Syncer, 2022/04/24
- [elpa] externals/vundo 10d5debe31 7/7: Version 2.0.0, ELPA Syncer, 2022/04/24
- [elpa] externals/vundo fd780553f3 3/7: Merge branch 'fix-option-name', ELPA Syncer, 2022/04/24
- [elpa] externals/vundo 7c64a07705 5/7: Merge branch 'pr-enter-exit-hooks',
ELPA Syncer <=
- [elpa] externals/vundo f2b2999fa9 6/7: * vundo.el (vundo-post-exit-hook): Fix docstring., ELPA Syncer, 2022/04/24