[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 117935d 200/310: Add progress reporter when searchi
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 117935d 200/310: Add progress reporter when searching for difference. |
Date: |
Sat, 28 Nov 2020 00:33:15 -0500 (EST) |
branch: externals/vlf
commit 117935db989e16eacc51d72b135ae46c3630ac56
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Add progress reporter when searching for difference.
---
vlf-ediff.el | 54 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 33 insertions(+), 21 deletions(-)
diff --git a/vlf-ediff.el b/vlf-ediff.el
index 9c76d05..6e82c57 100644
--- a/vlf-ediff.el
+++ b/vlf-ediff.el
@@ -99,12 +99,12 @@ respectively of difference list, runs ediff over the
adjacent chunks."
(defun vlf-next-chunk ()
"Move to next chunk."
(let ((new-start (+ vlf-start-pos vlf-batch-size)))
- (vlf-move-to-chunk new-start (+ new-start vlf-batch-size))))
+ (vlf-move-to-chunk new-start (+ new-start vlf-batch-size) t)))
(defun vlf-prev-chunk ()
"Move to previous chunk."
(let ((new-start (- vlf-start-pos vlf-batch-size)))
- (vlf-move-to-chunk new-start (+ new-start vlf-batch-size))))
+ (vlf-move-to-chunk new-start (+ new-start vlf-batch-size) t)))
(defun vlf-ediff-next (buffer-A buffer-B &optional next-func)
"Activate ediff over the next difference in BUFFER-A and BUFFER-B.
@@ -114,10 +114,18 @@ no difference at the current ones."
(setq buffer-A (current-buffer)) ;names change, so reference by buffer object
(let ((end-A (= vlf-start-pos vlf-end-pos))
(content (buffer-substring-no-properties (point-min)
- (point-max))))
+ (point-max)))
+ (min-file-size vlf-file-size)
+ (is-forward (eq next-func 'vlf-next-chunk)))
(set-buffer buffer-B)
(setq buffer-B (current-buffer))
- (let ((end-B (= vlf-start-pos vlf-end-pos)))
+ (setq min-file-size (min min-file-size vlf-file-size))
+ (let ((end-B (= vlf-start-pos vlf-end-pos))
+ (reporter (make-progress-reporter
+ "Searching for difference..."
+ (if is-forward vlf-start-pos
+ (- min-file-size vlf-end-pos))
+ min-file-size)))
(while (and (or (not end-A) (not end-B))
(equal content (buffer-substring-no-properties
(point-min) (point-max))))
@@ -127,27 +135,31 @@ no difference at the current ones."
(funcall next-func)
(setq content (buffer-substring-no-properties (point-min)
(point-max))
- end-A (= vlf-start-pos vlf-end-pos))))
- (when (and end-A end-B)
- (message "No (more) differences")
- (set-buffer buffer-A)
- (if (eq next-func 'vlf-next-chunk)
- (let ((max-file-size vlf-file-size))
- (with-current-buffer buffer-B
- (setq max-file-size (max max-file-size vlf-file-size))
- (vlf-move-to-chunk (- max-file-size vlf-batch-size)
- max-file-size))
- (vlf-move-to-chunk (- max-file-size vlf-batch-size)
- max-file-size))
- (vlf-beginning-of-file)
- (set-buffer buffer-B)
- (vlf-beginning-of-file))))
+ end-A (= vlf-start-pos vlf-end-pos)))
+ (progress-reporter-update reporter
+ (if is-forward vlf-end-pos
+ (- vlf-file-size vlf-start-pos))))
+ (progress-reporter-done reporter)
+ (cond ((or (not end-A) (not end-B))
+ (vlf-update-buffer-name)
+ (set-buffer buffer-A)
+ (vlf-update-buffer-name))
+ (is-forward ;end of both files
+ (let ((max-file-size vlf-file-size))
+ (with-current-buffer buffer-A
+ (setq max-file-size (max max-file-size vlf-file-size))
+ (vlf-move-to-chunk (- max-file-size vlf-batch-size)
+ max-file-size))
+ (vlf-move-to-chunk (- max-file-size vlf-batch-size)
+ max-file-size)))
+ (t (vlf-beginning-of-file)
+ (set-buffer buffer-A)
+ (vlf-beginning-of-file))))
(ediff-buffers buffer-A buffer-B
`((lambda () (setq vlf-ediff-session t)
(if (< 0 ediff-number-of-differences)
(ediff-jump-to-difference
- ,(if (eq next-func 'vlf-next-chunk) 1
- -1))))))))
+ ,(if is-forward 1 -1))))))))
(defadvice ediff-next-difference (around vlf-ediff-next-difference
compile activate)
- [elpa] externals/vlf b62bc04 301/310: Issue 31 Make vlf-batch-size configurable in the remote case, (continued)
- [elpa] externals/vlf b62bc04 301/310: Issue 31 Make vlf-batch-size configurable in the remote case, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 55e0c40 300/310: Explicitly set coding-system-for-read to the current coding when not, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 4eaf763 297/310: Rename vlf-integrate.el to vlf-setup.el, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf efffeb5 310/310: Bump vlf version after previous fix, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f4aa108 308/310: * vlf.el: Use GPL version 3, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f4ee23c 156/310: Fix chunk end adjustment and save for current and older Emacsen., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2e2bca6 169/310: Fix file size determination after save and move vlf-with-undo-disabled, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 290c4ac 176/310: Fix save with adjustment., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d88080f 178/310: Don't apply VLF over ebrowse and TAGS databases., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 4d82c78 197/310: - don't nullify default buffer coding system, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 117935d 200/310: Add progress reporter when searching for difference.,
Stefan Monnier <=
- [elpa] externals/vlf bfcbfd3 132/310: Make error message more descriptive., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 28646fb 148/310: Reduce scope of vlf-with-undo-disabled usages., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 72fec35 162/310: Update README and bump version., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 65b4d74 170/310: Refactor vlf-write., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 099adab 171/310: Fix abort-if-file-too-large advice not to activate VLF in case of empty, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf c58d0d8 180/310: Shift buffer-undo-list elements when chunk beginning moves., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 4f99eaa 183/310: Fixes to tiny chunk moves., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 7794b2c 185/310: Merge branch 'shift-undo' into chunk-move, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d7766f2 209/310: Update documentation and mark autoloaded functions as interactive., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 5d30eb4 206/310: Use single ediff pass to adjust borders. Protect against user, Stefan Monnier, 2020/11/28