[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 0d2c096 258/310: Restore batch size and hexl mode i
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 0d2c096 258/310: Restore batch size and hexl mode in case of failed search or occur. |
Date: |
Sat, 28 Nov 2020 00:33:27 -0500 (EST) |
branch: externals/vlf
commit 0d2c096ed62430287d9922726fe46cc69831e7cd
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Restore batch size and hexl mode in case of failed search or occur.
---
vlf-occur.el | 8 +++++---
vlf-search.el | 32 +++++++++++++++++++++-----------
2 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/vlf-occur.el b/vlf-occur.el
index 5e53cfb..a41f448 100644
--- a/vlf-occur.el
+++ b/vlf-occur.el
@@ -200,7 +200,8 @@ Prematurely ending indexing will still show what's found so
far."
(let ((start-pos vlf-start-pos)
(end-pos vlf-end-pos)
(pos (point))
- (batch-size vlf-batch-size))
+ (batch-size vlf-batch-size)
+ (is-hexl (derived-mode-p 'hexl-mode)))
(vlf-tune-batch (if (derived-mode-p 'hexl-mode)
'(:hexl :dehexlify :insert :encode)
'(:insert :encode)))
@@ -209,8 +210,9 @@ Prematurely ending indexing will still show what's found so
far."
(goto-char (point-min))
(unwind-protect (vlf-build-occur regexp (current-buffer))
(vlf-move-to-chunk start-pos end-pos)
- (goto-char pos)))
- (setq vlf-batch-size batch-size)))
+ (if is-hexl (vlf-tune-hexlify))
+ (goto-char pos)
+ (setq vlf-batch-size batch-size)))))
(run-hook-with-args 'vlf-after-batch-functions 'occur))
(defun vlf-build-occur (regexp vlf-buffer)
diff --git a/vlf-search.el b/vlf-search.el
index 7b2f02b..45fe1c9 100644
--- a/vlf-search.el
+++ b/vlf-search.el
@@ -33,7 +33,8 @@
&optional reporter time)
"Search for REGEXP COUNT number of times forward or BACKWARD.
BATCH-STEP is amount of overlap between successive chunks.
-Use existing REPORTER and start TIME if given."
+Use existing REPORTER and start TIME if given.
+Return t if search has been at least partially successful."
(if (<= count 0)
(error "Count must be positive"))
(run-hook-with-args 'vlf-before-batch-functions 'search)
@@ -125,15 +126,18 @@ Use existing REPORTER and start TIME if given."
vlf-end-pos)))))
(progress-reporter-done reporter))
(set-buffer-modified-p nil)
+ (if is-hexl (vlf-tune-hexlify))
(if font-lock (font-lock-mode 1))
- (if backward
- (vlf-goto-match match-chunk-start match-chunk-end
- match-end-pos match-start-pos
- count to-find time)
- (vlf-goto-match match-chunk-start match-chunk-end
- match-start-pos match-end-pos
- count to-find time))
- (run-hook-with-args 'vlf-after-batch-functions 'search)))))
+ (let ((result
+ (if backward
+ (vlf-goto-match match-chunk-start match-chunk-end
+ match-end-pos match-start-pos
+ count to-find time)
+ (vlf-goto-match match-chunk-start match-chunk-end
+ match-start-pos match-end-pos
+ count to-find time))))
+ (run-hook-with-args 'vlf-after-batch-functions 'search)
+ result)))))
(defun vlf-goto-match (match-chunk-start match-chunk-end
match-pos-start match-pos-end
@@ -179,7 +183,9 @@ Search is performed chunk by chunk in `vlf-batch-size'
memory."
(if regexp-history
(car regexp-history)))
(or current-prefix-arg 1))))
- (vlf-re-search regexp count nil (min 1024 (/ vlf-batch-size 8))))
+ (let ((batch-size vlf-batch-size))
+ (or (vlf-re-search regexp count nil (min 1024 (/ vlf-batch-size 8)))
+ (setq vlf-batch-size batch-size))))
(defun vlf-re-search-backward (regexp count)
"Search backward for REGEXP prefix COUNT number of times.
@@ -189,7 +195,9 @@ Search is performed chunk by chunk in `vlf-batch-size'
memory."
(if regexp-history
(car regexp-history)))
(or current-prefix-arg 1))))
- (vlf-re-search regexp count t (min 1024 (/ vlf-batch-size 8))))
+ (let ((batch-size vlf-batch-size))
+ (or (vlf-re-search regexp count t (min 1024 (/ vlf-batch-size 8)))
+ (setq vlf-batch-size batch-size))))
(defun vlf-goto-line (n)
"Go to line N. If N is negative, count from the end of file."
@@ -201,6 +209,7 @@ Search is performed chunk by chunk in `vlf-batch-size'
memory."
(min tramp-verbose 2)))
(start-pos vlf-start-pos)
(end-pos vlf-end-pos)
+ (batch-size vlf-batch-size)
(pos (point))
(is-hexl (derived-mode-p 'hexl-mode))
(font-lock font-lock-mode)
@@ -276,6 +285,7 @@ Search is performed chunk by chunk in `vlf-batch-size'
memory."
(vlf-move-to-chunk-2 start-pos end-pos))
(vlf-update-buffer-name)
(goto-char pos)
+ (setq vlf-batch-size batch-size)
(message "Unable to find line"))
(run-hook-with-args 'vlf-after-batch-functions 'goto-line))))
- [elpa] externals/vlf 35ede94 255/310: Restore batch size after save with adjustment., (continued)
- [elpa] externals/vlf 35ede94 255/310: Restore batch size after save with adjustment., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ff06509 261/310: Document tune functionality., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 1c961f4 285/310: Fix whole file reload in read-only buffer on vlf-mode exit., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f4526a1 287/310: Forbid short-cutting in line search., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf fd90b3a 295/310: Use xdigit regex class in vlf-hexl-adjust-addresses., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf df677c1 302/310: Issue 35: make mode-line batch indicators more accurate, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a568d2d 307/310: packages/vlf: Update copyright dates and bump version., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 0ecb40a 124/310: Keep as much editing as possible when moving to intersecting chunk., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 86223ed 234/310: Fixes to hexl-mode integration., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9271f68 256/310: Add function to linearly search best batch size according to existing, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 0d2c096 258/310: Restore batch size and hexl mode in case of failed search or occur.,
Stefan Monnier <=
- [elpa] externals/vlf b918791 265/310: Improve vlf performance with hexl-mode. Align batches to hexl-bits, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2e9ff70 238/310: Enlarge default batch size but keep is small on initial load of remote, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d85f3d4 246/310: Fix access to uninitialized measurements when tuning., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ca56498 259/310: Change vlf-tune-get-optimal to optimize on total time of primitive, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 51d95ec 152/310: Add command to display batch starting from point., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 46e39a0 153/310: Version 1.0., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d1af56d 167/310: Fix opening of files for GNU Emacs 23., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8ab1c6a 136/310: Disable undo and mark buffer as not modified when invoking search or, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf bb482f0 173/310: Fix file size determination for symbolic links., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9ffb968 172/310: Remove defadvice abort-if-file-too-large argument list so it works, Stefan Monnier, 2020/11/28