emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vlf 1589cf9 081/310: Make custom revert function local


From: Stefan Monnier
Subject: [elpa] externals/vlf 1589cf9 081/310: Make custom revert function local only for vlfi buffers.
Date: Sat, 28 Nov 2020 00:32:51 -0500 (EST)

branch: externals/vlf
commit 1589cf97360ba014430714b54426c8b222068083
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>

    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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]