branch: externals/vlf
commit 1589cf97360ba014430714b54426c8b222068083
Author: Andrey Kotlarski <[email protected]>
Commit: Andrey Kotlarski <[email protected]>
Make custom revert function local only for vlfi buffers.
---
vlfi.el | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/vlfi.el b/vlfi.el
index c8c711a..3784890 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -76,6 +76,7 @@
(set-buffer-modified-p nil)
(buffer-disable-undo)
(add-hook 'write-contents-functions 'vlfi-write)
+ (make-local-variable 'revert-buffer-function)
(setq revert-buffer-function 'vlfi-revert)
(make-local-variable 'vlfi-batch-size)
(put 'vlfi-batch-size 'permanent-local t)
@@ -222,10 +223,14 @@ With FROM-END prefix, start from the back."
(interactive)
(vlfi-insert-file t))
-(defun vlfi-revert (&rest args)
- "Revert current chunk. Ignore ARGS."
- (ignore args)
- (vlfi-move-to-chunk vlfi-start-pos vlfi-end-pos))
+(defun vlfi-revert (&optional ignore-auto noconfirm)
+ "Revert current chunk. Ignore IGNORE-AUTO.
+Ask for confirmation if NOCONFIRM is nil."
+ (ignore ignore-auto)
+ (or noconfirm
+ (yes-or-no-p (format "Revert buffer from file %s? "
+ buffer-file-name))
+ (vlfi-move-to-chunk vlfi-start-pos vlfi-end-pos)))
(defun vlfi-jump-to-chunk (n)
"Go to to chunk N."