[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf e67895a 068/310: Optionally strip superfluous opera
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf e67895a 068/310: Optionally strip superfluous operations when inserting batches. |
Date: |
Sat, 28 Nov 2020 00:32:48 -0500 (EST) |
branch: externals/vlf
commit e67895afc46613a5e27bf7e8dc63e3138d827f2b
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Optionally strip superfluous operations when inserting batches.
---
vlfi.el | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/vlfi.el b/vlfi.el
index 4848e17..347788f 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -276,9 +276,10 @@ When prefix argument is negative
(set-buffer-modified-p nil)
(vlfi-update-buffer-name))
-(defun vlfi-move-to-batch (start)
+(defun vlfi-move-to-batch (start &optional minimal)
"Move to batch determined by START.
-Adjust according to file start/end and show `vlfi-batch-size' bytes."
+Adjust according to file start/end and show `vlfi-batch-size' bytes.
+When given MINIMAL flag, skip non important operations."
(setq vlfi-start-pos (max 0 start)
vlfi-end-pos (+ vlfi-start-pos vlfi-batch-size))
(if (< vlfi-file-size vlfi-end-pos) ; re-check file size
@@ -291,12 +292,14 @@ Adjust according to file start/end and show
`vlfi-batch-size' bytes."
(insert-file-contents buffer-file-name nil
vlfi-start-pos vlfi-end-pos)
(goto-char pos))
- (set-visited-file-modtime)
(set-buffer-modified-p nil)
- (vlfi-update-buffer-name))
+ (unless minimal
+ (set-visited-file-modtime)
+ (vlfi-update-buffer-name)))
-(defun vlfi-move-to-chunk (start end)
- "Move to chunk determined by START END."
+(defun vlfi-move-to-chunk (start end &optional minimal)
+ "Move to chunk determined by START END.
+When given MINIMAL flag, skip non important operations."
(if (< vlfi-file-size end) ; re-check file size
(setq vlfi-file-size (vlfi-get-file-size buffer-file-name)))
(setq vlfi-start-pos (max 0 start)
@@ -307,9 +310,10 @@ Adjust according to file start/end and show
`vlfi-batch-size' bytes."
(insert-file-contents buffer-file-name nil
vlfi-start-pos vlfi-end-pos)
(goto-char pos))
- (set-visited-file-modtime)
(set-buffer-modified-p nil)
- (vlfi-update-buffer-name))
+ (unless minimal
+ (set-visited-file-modtime)
+ (vlfi-update-buffer-name)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; search
@@ -344,7 +348,7 @@ Adjust according to file start/end and show
`vlfi-batch-size' bytes."
(vlfi-move-to-batch
(if (< match-start-pos batch-move)
(- match-start-pos vlfi-batch-size)
- batch-move)))
+ batch-move) t))
(goto-char (if (< match-start-pos
vlfi-end-pos)
(- match-start-pos
@@ -365,7 +369,7 @@ Adjust according to file start/end and show
`vlfi-batch-size' bytes."
(vlfi-move-to-batch
(if (< batch-move match-end-pos)
match-end-pos
- batch-move)))
+ batch-move) t))
(goto-char (if (< vlfi-start-pos match-end-pos)
(- match-end-pos vlfi-start-pos)
(point-min)))
@@ -383,9 +387,9 @@ Adjust according to file start/end and show
`vlfi-batch-size' bytes."
According to COUNT and left TO-FIND, show if search has been
successful. Return nil if nothing found."
(let ((success (zerop to-find)))
- (or success
- (vlfi-move-to-batch (- match-pos-start
- (/ vlfi-batch-size 2))))
+ (if success
+ (vlfi-update-buffer-name)
+ (vlfi-move-to-batch (- match-pos-start (/ vlfi-batch-size 2))))
(let* ((match-end (- match-pos-end vlfi-start-pos))
(overlay (make-overlay (- match-pos-start vlfi-start-pos)
match-end)))
- [elpa] externals/vlf a42247c 150/310: Automatically scroll to adjacent batch when start or end of chunk is, (continued)
- [elpa] externals/vlf a42247c 150/310: Automatically scroll to adjacent batch when start or end of chunk is, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 959bbc7 155/310: Disable undo in cases of partial chunk move., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a65f3a4 143/310: Check for unsaved changes before search query and don't enable undo if, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 42e581d 144/310: Add command to unconditionally open fresh VLF buffer to visit occur, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 3e8098a 149/310: Rename vlf-discard-edit -> vlf-refresh., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf c0a85cd 159/310: Fix position when moving to overlapping chunk., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2aea17a 163/310: Fix behaviour when size is missing (creating file) in, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 88924f9 164/310: Fix vlf-write behaviour for newly created file., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9c50487 165/310: Introduce list of major modes where VLF will not activate., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 152462a 166/310: Fix autoloads in last commit., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e67895a 068/310: Optionally strip superfluous operations when inserting batches.,
Stefan Monnier <=
- [elpa] externals/vlf 6773248 104/310: Optimize a bit goto line., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 4134de0 177/310: Add intelligent recenter chunk around point functionality., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9b22b74 134/310: Add gitignore., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2dba838 140/310: In case original VLF buffer has been killed, try to find existing VLF, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf efae918 138/310: Turn vlf into minor mode., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e36492b 182/310: Optimize chunk jumping for current GNU Emacs releases. Fix moving by, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f1ade81 069/310: Add go to line command., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 3fb898e 070/310: Add automatic batching when scrolling., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf fc689d5 071/310: Make coding system conversion on write more idiomatic., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 74febeb 072/310: Remove ability to launch VLFI from file end. It's superseded by, Stefan Monnier, 2020/11/28