[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 924d6b1 219/310: Revert to using insert-file-conten
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 924d6b1 219/310: Revert to using insert-file-contents instead of manual decoding. |
Date: |
Sat, 28 Nov 2020 00:33:19 -0500 (EST) |
branch: externals/vlf
commit 924d6b18fa54ee9c069d29f3394e842b38c8a280
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Revert to using insert-file-contents instead of manual decoding.
---
vlf-base.el | 44 ++++++++++++++------------------------------
1 file changed, 14 insertions(+), 30 deletions(-)
diff --git a/vlf-base.el b/vlf-base.el
index 2a530f8..d8f60a1 100644
--- a/vlf-base.el
+++ b/vlf-base.el
@@ -27,15 +27,12 @@
;;; Code:
-(defgroup vlf nil
- "View Large Files in Emacs."
- :prefix "vlf-"
- :group 'files)
+(defgroup vlf nil "View Large Files in Emacs."
+ :prefix "vlf-" :group 'files)
(defcustom vlf-batch-size 1024
"Defines how large each batch of file data is (in bytes)."
- :group 'vlf
- :type 'integer)
+ :group 'vlf :type 'integer)
(put 'vlf-batch-size 'permanent-local t)
;;; Keep track of file position.
@@ -221,14 +218,15 @@ bytes added to the end."
(goto-char (or (byte-to-position (+ pos (car shifts)))
(point-max)))))
(set-buffer-modified-p nil)
- (setq buffer-undo-list nil)
+ (or (eq buffer-undo-list t)
+ (setq buffer-undo-list nil))
shifts))
(defun vlf-insert-file-contents (start end adjust-start adjust-end
&optional position)
"Adjust chunk at absolute START to END till content can be\
-properly decoded. ADJUST-START determines if trying to prepend bytes\
- to the beginning, ADJUST-END - append to the end.
+properly decoded. ADJUST-START determines if trying to prepend bytes
+to the beginning, ADJUST-END - append to the end.
Use buffer POSITION as start if given.
Return number of bytes moved back for proper decoding and number of
bytes added to the end."
@@ -245,7 +243,7 @@ bytes added to the end."
(setq shift-start (vlf-adjust-start start safe-end position
adjust-end)
start (- start shift-start))
- (vlf-insert-file-contents-1 start safe-end position))
+ (vlf-insert-file-contents-1 start safe-end))
(if adjust-end
(setq shift-end (- (car (vlf-delete-region position start
safe-end end
@@ -254,23 +252,9 @@ bytes added to the end."
end)))
(cons shift-start shift-end)))
-(defun vlf-insert-file-contents-1 (start end position)
- "Extract decoded file bytes START to END at POSITION."
- (let ((coding buffer-file-coding-system))
- (insert-file-contents-literally buffer-file-name nil start end)
- (let ((coding-system-for-read coding))
- (decode-coding-inserted-region position (point-max)
- buffer-file-name nil start end)))
- (when (eq (detect-coding-region position (min (+ position
- vlf-sample-size)
- (point-max)) t)
- 'no-conversion)
- (delete-region position (point-max))
- (insert-file-contents-literally buffer-file-name nil start end)
- (let ((coding-system-for-read nil))
- (decode-coding-inserted-region position (point-max)
- buffer-file-name nil start end)))
- (setq buffer-file-coding-system last-coding-system-used))
+(defun vlf-insert-file-contents-1 (start end)
+ "Extract decoded file bytes START to END."
+ (insert-file-contents buffer-file-name nil start end))
(defun vlf-adjust-start (start end position adjust-end)
"Adjust chunk beginning at absolute START to END till content can\
@@ -283,8 +267,8 @@ Return number of bytes moved back for proper decoding."
(strict (or (= sample-end vlf-file-size)
(and (not adjust-end) (= sample-end end))))
(shift 0))
- (while (and (progn (vlf-insert-file-contents-1
- safe-start sample-end position)
+ (while (and (progn (vlf-insert-file-contents-1 safe-start
+ sample-end)
(not (zerop safe-start)))
(< shift 3)
(let ((diff (- chunk-size
@@ -304,7 +288,7 @@ Return number of bytes moved back for proper decoding."
position t 'start)))
(unless (= sample-end end)
(delete-region position (point-max))
- (vlf-insert-file-contents-1 safe-start end position))
+ (vlf-insert-file-contents-1 safe-start end))
(- start safe-start)))
(defun vlf-delete-region (position start end border cut-point from-start
- [elpa] externals/vlf 66db665 189/310: Fix follow functionality and explicitly set variable as buffer local., (continued)
- [elpa] externals/vlf 66db665 189/310: Fix follow functionality and explicitly set variable as buffer local., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 38e8f6c 199/310: Update file size when moving to end of buffer., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 47c154c 194/310: Fix detection of good chunk start., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 1a1ce27 212/310: Add progress reporters for the optimized part of line search., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e747de4 204/310: Unify and optimize deletion., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9510c70 215/310: Retry decoding when the initial attempt seems wrong., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 5c604c4 211/310: Optimize vlf-goto-line not to decode batches as long as possible., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a71ee32 216/310: Skip adjustment in some cases of overlapping chunk., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf b235cf9 224/310: Execute vlf-after-batch-functions hook even on user quit command before, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 6bb60b7 225/310: Fix hexl scroll up called from scroll down behavior., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 924d6b1 219/310: Revert to using insert-file-contents instead of manual decoding.,
Stefan Monnier <=
- [elpa] externals/vlf 859c1e4 223/310: Fix hook names., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 694d1de 235/310: Allow vlf-occur results be saved to file and later reused., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 274c5ab 233/310: Perform search, occur and ediff operations over hexl content instead, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d9cc6fb 264/310: Fix vlf-tune-optimal-load in case best value prunes slower times leaving, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d1a6800 284/310: Move vlf information from buffer name to the mode line., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a7be713 283/310: Set vlf-tune-max with proper value in case RAM size is wrongly, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf bc398d6 291/310: - don't adjust start on next occur batch, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a01e9ed 304/310: Minor README additions., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 31b292d 305/310: fixed large-file-warning-threshold error, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 63d23ac 309/310: Make vlf handle nil large-file-warning-threshold value, Stefan Monnier, 2020/11/28