1
0
mirror of https://github.com/m00natic/vlfi.git synced 2025-01-31 02:00:47 +00:00

Fix when batch hooks are run for occur and save.

This commit is contained in:
Andrey Kotlarski 2014-02-14 12:34:31 +02:00
parent 074f9e960d
commit 8c61b776d6
2 changed files with 40 additions and 40 deletions

View File

@ -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."

View File

@ -33,13 +33,13 @@
"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)
(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? "))
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)
(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)
@ -52,7 +52,6 @@ Save anyway? "))
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))
@ -68,8 +67,8 @@ Save anyway? "))
(+ 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)))))
(goto-char pos)))))
(run-hook-with-args 'vlf-after-batch-functions 'write))
t)
(defun vlf-file-shift-back (size-change)