[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf c812288 017/310: Fix small issues with forward sear
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf c812288 017/310: Fix small issues with forward search and add report progress. |
Date: |
Sat, 28 Nov 2020 00:32:38 -0500 (EST) |
branch: externals/vlf
commit c812288ab7d5474c28d514aa6c118215bec0246c
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Fix small issues with forward search and add report progress.
---
vlfi.el | 48 ++++++++++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/vlfi.el b/vlfi.el
index 121b84b..e6dd2db 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -228,26 +228,34 @@ OP-TYPE specifies the file operation being performed over
FILENAME."
(let ((start vlfi-start-pos)
(end vlfi-end-pos)
(pos (point))
- (to-find count))
- (catch 'end-of-file
- (while (not (zerop to-find))
- (cond ((re-search-forward regexp nil t)
- (setq to-find (1- to-find)))
- ((= vlfi-end-pos vlfi-file-size)
- (throw 'end-of-file nil))
- (t (vlfi-next-batch 1)))))
- (or (zerop to-find)
- (if (< to-find count)
- (message "Moved to the %d match which is last"
- (- count to-find))
- (let ((inhibit-read-only t))
- (insert-file-contents buffer-file-name nil start end))
- (goto-char pos)
- (setq vlfi-start-pos start
- vlfi-end-pos end)
- (set-buffer-modified-p nil)
- (vlfi-update-buffer-name)
- (message "Not found")))))
+ (to-find count)
+ (search-reporter (make-progress-reporter
+ (concat "Searching for " regexp)
+ vlfi-start-pos vlfi-file-size)))
+ (unwind-protect
+ (catch 'end-of-file
+ (while (not (zerop to-find))
+ (cond ((re-search-forward regexp nil t)
+ (setq to-find (1- to-find)))
+ ((= vlfi-end-pos vlfi-file-size)
+ (throw 'end-of-file nil))
+ (t (vlfi-next-batch 1)
+ (progress-reporter-update search-reporter
+ vlfi-end-pos)))))
+ (progress-reporter-done search-reporter)
+ (or (zerop to-find)
+ (if (< to-find count)
+ (message "Moved to the %d match which is last"
+ (- count to-find))
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (insert-file-contents buffer-file-name nil start end))
+ (goto-char pos)
+ (setq vlfi-start-pos start
+ vlfi-end-pos end)
+ (set-buffer-modified-p nil)
+ (vlfi-update-buffer-name)
+ (message "Not found"))))))
(provide 'vlfi)
- [elpa] branch externals/vlf created (now efffeb5), Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 78cd8fc 002/310: Add latest changes from GNU ELPA vlf.el., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e740b91 005/310: Update `vlf-if-file-too-large' example usage., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e3087a8 010/310: Rename vlf.el., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf c3051e6 012/310: Show file position in percentages., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e693e8f 013/310: Disable undo information for VLFI buffers., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf fb9aa67 020/310: Remove clutter form file name indicators., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf c812288 017/310: Fix small issues with forward search and add report progress.,
Stefan Monnier <=
- [elpa] externals/vlf 090cebc 028/310: Add procedure to insert strictly batch sized chunk (if possible)., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf b40bb60 025/310: Tweaks and fixes to searching., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 748fd14 027/310: More key-binding simplification., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 670561e 031/310: Optimize search a bit., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ab20671 033/310: Abstract batch overlapping during search and optimize a bit., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e387ed5 035/310: Add forgotten local variable statement and documentation., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 0dd4ba8 014/310: Add regex search forward functionality., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9e27aeb 021/310: Keep stable cursor position when moving through chunks., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 81e4fe1 016/310: Merge branch 'search' of https://github.com/m00natic/vlfi into search, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e43725e 007/310: Add autoload cookies to fix package installation., Stefan Monnier, 2020/11/28