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

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

[elpa] externals/vlf 569e4b2 237/310: Don't ask needles questions on cha


From: Stefan Monnier
Subject: [elpa] externals/vlf 569e4b2 237/310: Don't ask needles questions on changing helm batch and restore undo
Date: Sat, 28 Nov 2020 00:33:23 -0500 (EST)

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

    Don't ask needles questions on changing helm batch and restore undo
    information when possible.
---
 vlf-base.el | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/vlf-base.el b/vlf-base.el
index 7c94ce5..cc04fee 100644
--- a/vlf-base.el
+++ b/vlf-base.el
@@ -126,12 +126,14 @@ bytes added to the end."
          (start (max 0 start))
          (end (min end vlf-file-size))
          (hexl (derived-mode-p 'hexl-mode))
-         (restore-hexl nil)
+         restore-hexl hexl-undo-list
          (edit-end (if modified
                        (progn
                          (when hexl
-                           (hexl-mode-exit)
-                           (setq restore-hexl t))
+                           (setq restore-hexl t
+                                 hexl-undo-list buffer-undo-list
+                                 buffer-undo-list t)
+                           (hexl-mode-exit))
                          (+ vlf-start-pos
                             (length (encode-coding-region
                                      (point-min) (point-max)
@@ -144,10 +146,14 @@ bytes added to the end."
             (when (or (not modified)
                       (y-or-n-p "Chunk modified, are you sure? ")) ;full chunk 
renewal
               (set-buffer-modified-p nil)
+              (if (consp hexl-undo-list)
+                  (setq hexl-undo-list nil))
               (vlf-move-to-chunk-2 start end)))
            ((and (= start vlf-start-pos) (= end edit-end))
-            (or modified
-                (vlf-move-to-chunk-2 start end)))
+            (unless modified
+              (if (consp hexl-undo-list)
+                  (setq hexl-undo-list nil))
+              (vlf-move-to-chunk-2 start end)))
            ((or (and (<= start vlf-start-pos) (<= edit-end end))
                 (not modified)
                 (y-or-n-p "Chunk modified, are you sure? "))
@@ -222,7 +228,9 @@ bytes added to the end."
                 (setq restore-hexl nil))
               (run-hooks 'vlf-after-chunk-update)
               (cons shift-start shift-end))))))
-    (if restore-hexl (hexl-mode))
+    (when restore-hexl
+      (hexl-mode)
+      (setq buffer-undo-list hexl-undo-list))
     shifts))
 
 (defun vlf-move-to-chunk-2 (start end)



reply via email to

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