[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf ac8d400 276/310: Fixes to hexl-mode activation.
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf ac8d400 276/310: Fixes to hexl-mode activation. |
Date: |
Sat, 28 Nov 2020 00:33:31 -0500 (EST) |
branch: externals/vlf
commit ac8d4008bd2231ed2f7326fab0391e017daa6a19
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Fixes to hexl-mode activation.
---
vlf-occur.el | 8 +++-----
vlf-search.el | 23 ++++++++++++++---------
vlf-write.el | 13 ++++++-------
3 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/vlf-occur.el b/vlf-occur.el
index 4694655..066709b 100644
--- a/vlf-occur.el
+++ b/vlf-occur.el
@@ -124,7 +124,7 @@ EVENT may hold details of the invocation."
pos-relative)))
(cond (current-prefix-arg
(setq vlf-buffer (vlf file t))
- (or not-hexl (vlf-tune-hexlify))
+ (or not-hexl (hexl-mode))
(switch-to-buffer occur-buffer))
((not (buffer-live-p vlf-buffer))
(unless (catch 'found
@@ -137,7 +137,7 @@ EVENT may hold details of the invocation."
(setq vlf-buffer buf)
(throw 'found t))))
(setq vlf-buffer (vlf file t))
- (or not-hexl (vlf-tune-hexlify)))
+ (or not-hexl (hexl-mode)))
(switch-to-buffer occur-buffer)
(setq vlf-occur-vlf-buffer vlf-buffer)))
(pop-to-buffer vlf-buffer)
@@ -201,8 +201,7 @@ 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)
- (is-hexl (derived-mode-p 'hexl-mode)))
+ (batch-size vlf-batch-size))
(vlf-tune-batch (if (derived-mode-p 'hexl-mode)
'(:hexl :raw)
'(:insert :encode)) t)
@@ -211,7 +210,6 @@ 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)
- (if is-hexl (vlf-tune-hexlify))
(goto-char pos)
(setq vlf-batch-size batch-size)))))
(run-hook-with-args 'vlf-after-batch-functions 'occur))
diff --git a/vlf-search.el b/vlf-search.el
index c60e631..7875b6c 100644
--- a/vlf-search.el
+++ b/vlf-search.el
@@ -135,7 +135,6 @@ Return t if search has been at least partially successful."
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))
(let ((result
(if backward
@@ -202,10 +201,13 @@ Search is performed chunk by chunk in `vlf-batch-size'
memory."
(if regexp-history
(car regexp-history)))
(or current-prefix-arg 1))))
- (let ((batch-size vlf-batch-size))
- (or (vlf-re-search regexp count nil (min 1024 (/ vlf-batch-size 8))
- nil nil t)
- (setq vlf-batch-size batch-size))))
+ (let ((batch-size vlf-batch-size)
+ success)
+ (unwind-protect
+ (setq success (vlf-re-search regexp count nil
+ (min 1024 (/ vlf-batch-size 8))
+ nil nil t))
+ (or success (setq vlf-batch-size batch-size)))))
(defun vlf-re-search-backward (regexp count)
"Search backward for REGEXP prefix COUNT number of times.
@@ -215,10 +217,13 @@ Search is performed chunk by chunk in `vlf-batch-size'
memory."
(if regexp-history
(car regexp-history)))
(or current-prefix-arg 1))))
- (let ((batch-size vlf-batch-size))
- (or (vlf-re-search regexp count t (min 1024 (/ vlf-batch-size 8))
- nil nil t)
- (setq vlf-batch-size batch-size))))
+ (let ((batch-size vlf-batch-size)
+ success)
+ (unwind-protect
+ (setq success (vlf-re-search regexp count t
+ (min 1024 (/ vlf-batch-size 8))
+ nil nil t))
+ (or success (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."
diff --git a/vlf-write.el b/vlf-write.el
index 5a656f7..d495b7f 100644
--- a/vlf-write.el
+++ b/vlf-write.el
@@ -55,6 +55,7 @@ If changing size of chunk, shift remaining file content."
(progn (vlf-tune-write nil nil vlf-start-pos t
(vlf-tune-encode-length (point-min)
(point-max)))
+ (if hexl (vlf-tune-hexlify))
(setq vlf-file-size (vlf-get-file-size
buffer-file-truename)
vlf-end-pos vlf-file-size)
@@ -64,8 +65,9 @@ If changing size of chunk, shift remaining file content."
(size-change (- vlf-end-pos vlf-start-pos
region-length)))
(if (zerop size-change)
- (vlf-tune-write nil nil vlf-start-pos t
- (- vlf-end-pos vlf-start-pos))
+ (progn (vlf-tune-write nil nil vlf-start-pos t
+ (- vlf-end-pos vlf-start-pos))
+ (if hexl (vlf-tune-hexlify)))
(let ((pos (point))
(font-lock font-lock-mode)
(batch-size vlf-batch-size)
@@ -76,9 +78,7 @@ If changing size of chunk, shift remaining file content."
(y-or-n-p "File content needs be adjusted\
till end. Use temporary copy of the whole file (slower but safer)? ")
(not vlf-save-in-place)))
- (let ((file-tmp (make-temp-file
- (file-name-nondirectory
- buffer-file-name))))
+ (let ((file-tmp (make-temp-file "vlf")))
(setq time (float-time))
(copy-file buffer-file-name file-tmp t t t t)
(if (< 0 size-change)
@@ -101,8 +101,7 @@ If changing size of chunk, shift remaining file content."
vlf-end-pos))
(vlf-update-buffer-name)
(goto-char pos)
- (message "Save took %f seconds" (- (float-time) time))))))
- (if hexl (vlf-tune-hexlify)))
+ (message "Save took %f seconds" (- (float-time) time)))))))
(run-hook-with-args 'vlf-after-batch-functions 'write))
t)
- [elpa] externals/vlf 5379943 242/310: Save times instead of speeds, compare on cumulative speed when tuning., (continued)
- [elpa] externals/vlf 5379943 242/310: Save times instead of speeds, compare on cumulative speed when tuning., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 0d9cc8e 245/310: Don't measure encoding of too small region when adjusting chunk start, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e8bb4a9 248/310: Apply batch size tuning on adjacent moves, search, save adjusting and, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d526ea8 257/310: Apply and restore batch size in more cases., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9b6657b 260/310: Replace usage of conservative tune in single batch operations with load, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2c660b0 269/310: Fix positive goto-line search and make highlighting of match optional., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 3cfa9b1 273/310: Refactor vlf-query-replace and don't adjust batch size if only, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 61599a0 274/310: Change linear tune to search only known measures and use it to, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a9c14e2 268/310: Add regexp query replace over whole file command., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 673ae08 277/310: Lower tramp verbosity level., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ac8d400 276/310: Fixes to hexl-mode activation.,
Stefan Monnier <=
- [elpa] externals/vlf f63ea96 272/310: Document new query replace and save options., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e4a2e80 266/310: Optimize goto-line for hexl-mode, no need to search., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 7b9befe 275/310: - don't load unnecessary data at the end of search or occur, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 842569a 270/310: Add ability to use temporary file when adjusting content on save., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d579b7b 279/310: Workaround local maximum in batch tune., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf b14c912 290/310: Copy around buffer specific profile vectors when forking new buffers., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf b300137 292/310: Encode smaller region to detect cut point overall offset in vlf-occur, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 86be483 293/310: Improve search precision., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a8ba836 298/310: Fix issue where tramp-verbose is bound to nil., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 25e16ef 303/310: Fix broken link in README, Stefan Monnier, 2020/11/28