mirror of
https://github.com/m00natic/vlfi.git
synced 2025-02-23 21:38:05 +00:00
Fix small issues with forward search and add report progress.
This commit is contained in:
parent
81e4fe19ac
commit
c812288ab7
14
vlfi.el
14
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))
|
||||
(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)))))
|
||||
(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")))))
|
||||
(message "Not found"))))))
|
||||
|
||||
(provide 'vlfi)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user