branch: externals/vlf
commit 0ff2f3eb9bd96da7a9465af3913e84c47a3a37c1
Merge: 9abee04 03f3233
Author: Andrey Kotlarski <[email protected]>
Commit: Andrey Kotlarski <[email protected]>
Merge branch 'master' into edit
---
vlfi.el | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/vlfi.el b/vlfi.el
index abac3ea..46c716d 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -334,21 +334,24 @@ OP-TYPE specifies the file operation being performed over
FILENAME."
"Move to chunk surrounding MATCH-POS-START and MATCH-POS-END.
According to COUNT and left TO-FIND, show if search has been
successful. Return nil if nothing found."
- (vlfi-move-to-batch (- match-pos-start (/ vlfi-batch-size 2)))
- (let* ((match-end (- match-pos-end vlfi-start-pos))
- (overlay (make-overlay (- match-pos-start vlfi-start-pos)
- match-end)))
- (overlay-put overlay 'face 'region)
- (goto-char match-end)
- (prog1 (cond ((zerop to-find) t)
- ((< to-find count)
- (message "Moved to the %d match which is last found"
- (- count to-find))
- t)
- (t (message "Not found")
- nil))
- (sit-for 0.1)
- (delete-overlay overlay))))
+ (let ((success (zerop to-find)))
+ (or success
+ (vlfi-move-to-batch (- match-pos-start
+ (/ vlfi-batch-size 2))))
+ (let* ((match-end (- match-pos-end vlfi-start-pos))
+ (overlay (make-overlay (- match-pos-start vlfi-start-pos)
+ match-end)))
+ (overlay-put overlay 'face 'region)
+ (or success (goto-char match-end))
+ (prog1 (cond (success t)
+ ((< to-find count)
+ (message "Moved to the %d match which is last"
+ (- count to-find))
+ t)
+ (t (message "Not found")
+ nil))
+ (sit-for 0.1)
+ (delete-overlay overlay)))))
(defun vlfi-re-search-forward (regexp count)
"Search forward for REGEXP prefix COUNT number of times."