1
0
mirror of https://github.com/m00natic/vlfi.git synced 2024-10-05 18:30:51 +01:00

Temporarily disable font-lock during multiple batch operations.

This commit is contained in:
Andrey Kotlarski 2014-01-23 02:11:44 +02:00
parent 1a1ce27d37
commit f83a212c52
3 changed files with 26 additions and 2 deletions

View File

@ -158,19 +158,23 @@ logical chunks in case there is no difference at the current ones."
(let ((end-A (= vlf-start-pos vlf-end-pos))
(chunk-A (cons vlf-start-pos vlf-end-pos))
(point-max-A (point-max))
(font-lock-A font-lock-mode)
(min-file-size vlf-file-size)
(forward-p (eq next-func 'vlf-next-chunk)))
(font-lock-mode 0)
(set-buffer buffer-B)
(setq buffer-B (current-buffer)
min-file-size (min min-file-size vlf-file-size))
(let ((end-B (= vlf-start-pos vlf-end-pos))
(chunk-B (cons vlf-start-pos vlf-end-pos))
(font-lock-B font-lock-mode)
(done nil)
(reporter (make-progress-reporter
"Searching for difference..."
(if forward-p vlf-start-pos
(- min-file-size vlf-end-pos))
min-file-size)))
(font-lock-mode 0)
(unwind-protect
(progn
(while (and (or (not end-A) (not end-B))
@ -217,6 +221,12 @@ logical chunks in case there is no difference at the current ones."
(and (not end-A) (not end-B)))
(vlf-ediff-refine buffer-A buffer-B)))
(setq done t))
(when font-lock-A
(set-buffer buffer-A)
(font-lock-mode 1))
(when font-lock-B
(set-buffer buffer-B)
(font-lock-mode 1))
(unless done
(set-buffer buffer-A)
(set-buffer-modified-p nil)

View File

@ -40,12 +40,14 @@ BATCH-STEP is amount of overlap between successive chunks."
(match-start-pos (+ vlf-start-pos (position-bytes (point))))
(match-end-pos match-start-pos)
(to-find count)
(font-lock font-lock-mode)
(reporter (make-progress-reporter
(concat "Searching for " regexp "...")
(if backward
(- vlf-file-size vlf-end-pos)
vlf-start-pos)
vlf-file-size)))
(font-lock-mode 0)
(vlf-with-undo-disabled
(unwind-protect
(catch 'end-of-file
@ -108,6 +110,7 @@ BATCH-STEP is amount of overlap between successive chunks."
vlf-end-pos)))))
(progress-reporter-done reporter))
(set-buffer-modified-p nil)
(if font-lock (font-lock-mode 1))
(if backward
(vlf-goto-match match-chunk-start match-chunk-end
match-end-pos match-start-pos
@ -179,11 +182,17 @@ Search is performed chunk by chunk in `vlf-batch-size' memory."
(let ((start-pos vlf-start-pos)
(end-pos vlf-end-pos)
(pos (point))
(font-lock font-lock-mode)
(success nil))
(font-lock-mode 0)
(unwind-protect
(if (< 0 n)
(let ((start 0)
(end (min vlf-batch-size vlf-file-size))
(reporter (make-progress-reporter
(concat "Searching for line "
(number-to-string n) "...")
0 vlf-file-size))
(inhibit-read-only t))
(setq n (1- n))
(vlf-with-undo-disabled
@ -230,9 +239,11 @@ Search is performed chunk by chunk in `vlf-batch-size' memory."
(vlf-move-to-chunk-2 start end)
(goto-char (point-max))
(setq success (vlf-re-search "[\n\C-m]" n t 0))))))
(if font-lock (font-lock-mode 1))
(unless success
(vlf-move-to-chunk-2 start-pos end-pos)
(goto-char pos)))))
(goto-char pos)
(message "Unable to find line")))))
(provide 'vlf-search)

View File

@ -52,10 +52,13 @@ Save anyway? "))
region-length)))
(if (zerop size-change)
(write-region nil nil buffer-file-name vlf-start-pos t)
(let ((pos (point)))
(let ((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)