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

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

[elpa] externals/vlf e4d886a 092/310: Add check if VLFI buffer has been


From: Stefan Monnier
Subject: [elpa] externals/vlf e4d886a 092/310: Add check if VLFI buffer has been modified before occur jumping to new
Date: Sat, 28 Nov 2020 00:32:53 -0500 (EST)

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

    Add check if VLFI buffer has been modified before occur jumping to new
    chunk.
---
 vlfi.el | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/vlfi.el b/vlfi.el
index 88a494f..b07111d 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -585,13 +585,21 @@ EVENT may hold details of the invocation."
               (match-pos (or (get-char-property pos 'match-pos)
                              (+ (get-char-property pos 'line-pos)
                                 pos-relative))))
-          (unless (buffer-live-p buffer)
-            (let ((occur-buffer (current-buffer)))
-              (setq buffer (vlfi file))
-              (switch-to-buffer occur-buffer)))
+          (or (buffer-live-p buffer)
+              (let ((occur-buffer (current-buffer)))
+                (setq buffer (vlfi file))
+                (switch-to-buffer occur-buffer)))
           (pop-to-buffer buffer)
-          (vlfi-move-to-chunk chunk-start chunk-end)
-          (goto-char match-pos)))))
+          (if (buffer-modified-p)
+              (cond ((and (= vlfi-start-pos chunk-start)
+                          (= vlfi-end-pos chunk-end))
+                     (goto-char match-pos))
+                    ((y-or-n-p "VLFI buffer has been modified.  \
+Really jump to new chunk? ")
+                     (vlfi-move-to-chunk chunk-start chunk-end)
+                     (goto-char match-pos)))
+            (vlfi-move-to-chunk chunk-start chunk-end)
+            (goto-char match-pos))))))
 
 (defun vlfi-occur (regexp)
   "Make whole file occur style index for REGEXP.



reply via email to

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