[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf fbe0814 097/310: Fix occur indexing not to skip las
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf fbe0814 097/310: Fix occur indexing not to skip last chunk. |
Date: |
Sat, 28 Nov 2020 00:32:54 -0500 (EST) |
branch: externals/vlf
commit fbe081417cb81ad652b2a84167d2bc82765b9940
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Fix occur indexing not to skip last chunk.
---
vlfi.el | 43 +++++++++++++++++++++++--------------------
1 file changed, 23 insertions(+), 20 deletions(-)
diff --git a/vlfi.el b/vlfi.el
index 2fb8ae0..23d4f39 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -438,7 +438,7 @@ Return number of bytes moved back for this to happen."
(or (byte-to-position
(- match-end-pos
vlfi-start-pos))
- (point-max))
+ (point-min))
(point-min)))
(progress-reporter-update reporter
vlfi-end-pos)))))
@@ -583,9 +583,8 @@ EVENT may hold details of the invocation."
(let ((chunk-start (get-char-property pos 'chunk-start))
(chunk-end (get-char-property pos 'chunk-end))
(buffer (get-char-property pos 'buffer))
- (match-pos (or (get-char-property pos 'match-pos)
- (+ (get-char-property pos 'line-pos)
- pos-relative))))
+ (match-pos (+ (get-char-property pos 'line-pos)
+ pos-relative)))
(or (buffer-live-p buffer)
(let ((occur-buffer (current-buffer)))
(setq buffer (vlfi file))
@@ -632,12 +631,13 @@ Prematurely ending indexing will still show what's found
so far."
(line-regexp (concat "\\(?5:[\n\C-m]\\)\\|\\(?10:"
regexp "\\)"))
(batch-step (/ vlfi-batch-size 8))
+ (end-of-file nil)
(reporter (make-progress-reporter
(concat "Building index for " regexp "...")
vlfi-start-pos vlfi-file-size)))
(unwind-protect
(progn
- (while (/= vlfi-end-pos vlfi-file-size)
+ (while (not end-of-file)
(if (re-search-forward line-regexp nil t)
(progn
(setq match-end-pos (+ vlfi-start-pos
@@ -675,29 +675,31 @@ Prematurely ending indexing will still show what's found
so far."
line))))
(setq last-match-line line
total-matches (1+ total-matches))
- (let ((line-start (+ (line-beginning-position)
- 1))
+ (let ((line-start (1+
+ (line-beginning-position)))
(match-pos (match-beginning 10)))
(add-text-properties ; mark match
(+ line-start match-pos (- last-line-pos))
(+ line-start (match-end 10)
(- last-line-pos))
- (list 'face 'match 'match-pos match-pos
+ (list 'face 'match
'help-echo
(format "Move to match %d"
total-matches))))))))
- (let ((batch-move (- vlfi-end-pos batch-step)))
- (vlfi-move-to-batch (if (< batch-move match-end-pos)
- match-end-pos
- batch-move) t))
- (goto-char (if (< vlfi-start-pos match-end-pos)
- (or (byte-to-position (- match-end-pos
- vlfi-start-pos))
- (point-min))
- (point-min)))
- (setq last-match-line 0
- last-line-pos (point-min))
- (progress-reporter-update reporter vlfi-end-pos)))
+ (setq end-of-file (= vlfi-end-pos vlfi-file-size))
+ (unless end-of-file
+ (let ((batch-move (- vlfi-end-pos batch-step)))
+ (vlfi-move-to-batch (if (< batch-move match-end-pos)
+ match-end-pos
+ batch-move) t))
+ (goto-char (if (< vlfi-start-pos match-end-pos)
+ (or (byte-to-position (- match-end-pos
+ vlfi-start-pos))
+ (point-min))
+ (point-min)))
+ (setq last-match-line 0
+ last-line-pos (line-beginning-position))
+ (progress-reporter-update reporter vlfi-end-pos))))
(progress-reporter-done reporter))
(if (zerop total-matches)
(progn (with-current-buffer occur-buffer
@@ -738,6 +740,7 @@ or \\[vlfi-discard-edit] to discard changes.")))
(defun vlfi-discard-edit ()
"Discard edit and refresh chunk from file."
(interactive)
+ (set-buffer-modified-p nil)
(vlfi-move-to-chunk vlfi-start-pos vlfi-end-pos)
(vlfi-mode)
(message "Switched to VLFI mode."))
- [elpa] externals/vlf b52ca6c 063/310: Don't change encoding for edited chunk, leave it to the user in case, (continued)
- [elpa] externals/vlf b52ca6c 063/310: Don't change encoding for edited chunk, leave it to the user in case, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a31be70 076/310: Update README and bump version., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ca8ba42 077/310: Fix position handling to correctly deal with multibyte characters., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 5aef3e1 078/310: Update file size changes more lazily., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ba439de 083/310: Initial generation of vlfi-occur results., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 83eb8a5 080/310: Fixes for GNU Emacs 23., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 70719b0 089/310: Add vlfi-occur-show command for showing match but still staying in, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a5fec57 090/310: Mostly documentation and commentary added., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf fbc3a37 094/310: Add tip for ability to change major mode and more section hierarchy., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf fd9c258 096/310: Use permanent buffer local write hook and update README., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf fbe0814 097/310: Fix occur indexing not to skip last chunk.,
Stefan Monnier <=
- [elpa] externals/vlf 28255a2 098/310: Correctly print MB (for older emacsen)., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ca13bea 101/310: Try utf-8 and if not successful, auto detect when adjusting chunk for, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ae775f8 107/310: Extend vlfi-goto-line to count lines from the end with negative, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 36d2ed4 109/310: Update README., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 3c2fb6b 111/310: Merge branch 'master' into chunk-opt2, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a0b8d5f 115/310: Merge pull request #3 from danlamanna/master, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8ed9192 117/310: Review fixes:, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 298d8f5 118/310: Keep track of current batch encoded size and allow fluctuation when, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 563d9ca 119/310: Fix vlfi-revert to revert on user confirmation., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 34dfbd2 121/310: Use set-visited-file-name and abstract getting current file size and, Stefan Monnier, 2020/11/28