]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/vlf/vlf-ediff.el
* packages/vlf: Perform search, occur and ediff operations over
[gnu-emacs-elpa] / packages / vlf / vlf-ediff.el
index 2b7c63f54f934ae659cbc504025089069769c172..ef9d5c7d95dca09824eccbd3b31e4a53ca5ea46a 100644 (file)
@@ -34,7 +34,6 @@
   "If non nil, specifies that ediff is done over VLF buffers.")
 (make-variable-buffer-local 'vlf-ediff-session)
 
-;;;###autoload
 (defun vlf-ediff-buffers (buffer-A buffer-B)
   "Run batch by batch ediff over VLF buffers BUFFER-A and BUFFER-B.
 Batch size is determined by the size in BUFFER-A.
@@ -93,10 +92,10 @@ respectively of difference list, runs ediff over the adjacent chunks."
                                       dir-B)))
                                    (ediff-get-default-file-name f 1)))
            (read-number "Batch size (in bytes): " vlf-batch-size))))
-  (let ((buffer-A (vlf file-A)))
+  (let ((buffer-A (vlf file-A t)))
     (set-buffer buffer-A)
     (vlf-set-batch-size batch-size)
-    (let ((buffer-B (vlf file-B)))
+    (let ((buffer-B (vlf file-B t)))
       (vlf-ediff-buffers buffer-A buffer-B))))
 
 (defadvice ediff-next-difference (around vlf-ediff-next-difference
@@ -161,12 +160,14 @@ logical chunks in case there is no difference at the current ones."
         (point-max-A (point-max))
         (font-lock-A font-lock-mode)
         (min-file-size vlf-file-size)
-        (forward-p (eq next-func 'vlf-next-chunk)))
+        (forward-p (eq next-func 'vlf-next-chunk))
+        (is-hexl (derived-mode-p 'hexl-mode)))
     (font-lock-mode 0)
     (set-buffer buffer-B)
     (run-hook-with-args 'vlf-before-batch-functions 'ediff)
     (setq buffer-B (current-buffer)
-          min-file-size (min min-file-size vlf-file-size))
+          min-file-size (min min-file-size vlf-file-size)
+          is-hexl (or is-hexl (derived-mode-p 'hexl-mode)))
     (let ((tramp-verbose (if (boundp 'tramp-verbose)
                              (min tramp-verbose 2)))
           (end-B (= vlf-start-pos vlf-end-pos))
@@ -187,7 +188,7 @@ logical chunks in case there is no difference at the current ones."
                                     buffer-B (point-min) (point-max)))
                             (with-current-buffer ediff-buffer
                               (ediff-update-diffs)
-                              (and (not end-A) (not end-B)
+                              (and (not end-A) (not end-B) (not is-hexl)
                                    (vlf-ediff-refine buffer-A
                                                      buffer-B))
                               (zerop ediff-number-of-differences))))
@@ -221,9 +222,10 @@ logical chunks in case there is no difference at the current ones."
                 (vlf-beginning-of-file))
               (set-buffer ediff-buffer)
               (ediff-update-diffs)
-              (if (or (not forward-p)
-                      (and (not end-A) (not end-B)))
-                  (vlf-ediff-refine buffer-A buffer-B)))
+              (or is-hexl
+                  (if (or (not forward-p)
+                          (and (not end-A) (not end-B)))
+                      (vlf-ediff-refine buffer-A buffer-B))))
             (setq done t))
         (unless done
           (set-buffer buffer-A)
@@ -234,7 +236,8 @@ logical chunks in case there is no difference at the current ones."
           (vlf-move-to-chunk (car chunk-B) (cdr chunk-B))
           (set-buffer ediff-buffer)
           (ediff-update-diffs)
-          (vlf-ediff-refine buffer-A buffer-B))
+          (or is-hexl
+              (vlf-ediff-refine buffer-A buffer-B)))
         (set-buffer buffer-A)
         (if font-lock-A (font-lock-mode 1))
         (run-hook-with-args 'vlf-after-batch-functions 'ediff)