[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 8c61b77 222/310: Fix when batch hooks are run for o
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 8c61b77 222/310: Fix when batch hooks are run for occur and save. |
Date: |
Sat, 28 Nov 2020 00:33:20 -0500 (EST) |
branch: externals/vlf
commit 8c61b776d61540d74b47636be84665a5ab153fa2
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Fix when batch hooks are run for occur and save.
---
vlf-occur.el | 7 +++---
vlf-write.el | 73 ++++++++++++++++++++++++++++++------------------------------
2 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/vlf-occur.el b/vlf-occur.el
index 5ecd07b..5d6f5d8 100644
--- a/vlf-occur.el
+++ b/vlf-occur.el
@@ -133,7 +133,8 @@ Prematurely ending indexing will still show what's found so
far."
(goto-char (point-min))
(run-hook-with-args 'vlf-before-batch-functions 'occur)
(vlf-with-undo-disabled
- (vlf-build-occur regexp vlf-buffer))))
+ (vlf-build-occur regexp vlf-buffer))
+ (run-hook-with-args 'vlf-before-after-functions 'occur)))
(run-hook-with-args 'vlf-before-batch-functions 'occur)
(let ((start-pos vlf-start-pos)
(end-pos vlf-end-pos)
@@ -143,8 +144,8 @@ 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)))))
- (run-hook-with-args 'vlf-before-after-functions 'occur))
+ (goto-char pos))))
+ (run-hook-with-args 'vlf-before-after-functions 'occur)))
(defun vlf-build-occur (regexp vlf-buffer)
"Build occur style index for REGEXP over VLF-BUFFER."
diff --git a/vlf-write.el b/vlf-write.el
index b974f94..1c5db49 100644
--- a/vlf-write.el
+++ b/vlf-write.el
@@ -33,43 +33,42 @@
"Write current chunk to file. Always return true to disable save.
If changing size of chunk, shift remaining file content."
(interactive)
- (and (buffer-modified-p)
- (or (verify-visited-file-modtime (current-buffer))
- (y-or-n-p "File has changed since visited or saved. \
-Save anyway? "))
- (if (zerop vlf-file-size) ;new file
- (progn
- (write-region nil nil buffer-file-name vlf-start-pos t)
- (setq vlf-file-size (vlf-get-file-size
- buffer-file-truename)
- vlf-end-pos vlf-file-size)
- (vlf-update-buffer-name))
- (widen)
- (let* ((region-length (length (encode-coding-region
- (point-min) (point-max)
- buffer-file-coding-system t)))
- (size-change (- vlf-end-pos vlf-start-pos
- region-length)))
- (if (zerop size-change)
- (write-region nil nil buffer-file-name vlf-start-pos t)
- (run-hook-with-args 'vlf-before-batch-functions 'write)
- (let ((tramp-verbose (if (boundp 'tramp-verbose)
- (min tramp-verbose 2)))
- (pos (point))
- (font-lock font-lock-mode))
- (font-lock-mode 0)
- (if (< 0 size-change)
- (vlf-file-shift-back size-change)
- (vlf-file-shift-forward (- size-change)))
- (if font-lock (font-lock-mode 1))
- (vlf-move-to-chunk-2 vlf-start-pos
- (if (< (- vlf-end-pos vlf-start-pos)
- vlf-batch-size)
- (+ vlf-start-pos vlf-batch-size)
- vlf-end-pos))
- (vlf-update-buffer-name)
- (goto-char pos))
- (run-hook-with-args 'vlf-after-batch-functions 'write)))))
+ (when (and (buffer-modified-p)
+ (or (verify-visited-file-modtime (current-buffer))
+ (y-or-n-p "File has changed since visited or saved.\
+ Save anyway? ")))
+ (run-hook-with-args 'vlf-before-batch-functions 'write)
+ (if (zerop vlf-file-size) ;new file
+ (progn (write-region nil nil buffer-file-name vlf-start-pos t)
+ (setq vlf-file-size (vlf-get-file-size
+ buffer-file-truename)
+ vlf-end-pos vlf-file-size)
+ (vlf-update-buffer-name))
+ (widen)
+ (let* ((region-length (length (encode-coding-region
+ (point-min) (point-max)
+ buffer-file-coding-system t)))
+ (size-change (- vlf-end-pos vlf-start-pos
+ region-length)))
+ (if (zerop size-change)
+ (write-region nil nil buffer-file-name vlf-start-pos t)
+ (let ((tramp-verbose (if (boundp 'tramp-verbose)
+ (min tramp-verbose 2)))
+ (pos (point))
+ (font-lock font-lock-mode))
+ (font-lock-mode 0)
+ (if (< 0 size-change)
+ (vlf-file-shift-back size-change)
+ (vlf-file-shift-forward (- size-change)))
+ (if font-lock (font-lock-mode 1))
+ (vlf-move-to-chunk-2 vlf-start-pos
+ (if (< (- vlf-end-pos vlf-start-pos)
+ vlf-batch-size)
+ (+ vlf-start-pos vlf-batch-size)
+ vlf-end-pos))
+ (vlf-update-buffer-name)
+ (goto-char pos)))))
+ (run-hook-with-args 'vlf-after-batch-functions 'write))
t)
(defun vlf-file-shift-back (size-change)
- [elpa] externals/vlf 9343095 193/310: Fix installation interfile dependencies and fix setting of local, (continued)
- [elpa] externals/vlf 9343095 193/310: Fix installation interfile dependencies and fix setting of local, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 88dba8b 195/310: Remove unnecessary addition to load-path on compile., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf dd43af5 192/310: Manually decode and use several bytes buffer when loading chunk., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 98ddc3a 198/310: Add by batch Ediff functionality., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9646b00 202/310: Adjust chunk borders to minimize shift differences and optimize, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d5d9cd7 205/310: Improve refining of differences and readjustment., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 0fa8e8d 210/310: Update buffer name on user interruption during ediff., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 30d2bb0 208/310: VLF buffer ediff now starts from the current chunks., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f83a212 213/310: Temporarily disable font-lock during multiple batch operations., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 074f9e9 221/310: Play nicely with hexl-mode., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8c61b77 222/310: Fix when batch hooks are run for occur and save.,
Stefan Monnier <=
- [elpa] externals/vlf 6476c1b 227/310: Update README, wording, add links and information on hooks., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8ba5bea 229/310: Don't run vlf-after-batch-functions hook in vlf-build-occur., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 569e4b2 237/310: Don't ask needles questions on changing helm batch and restore undo, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 1f9ba7c 230/310: Use derived-mode-p., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 32ff2cb 239/310: Add bookkeeping module., Stefan Monnier, 2020/11/28
- [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