[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 66db665 189/310: Fix follow functionality and expli
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 66db665 189/310: Fix follow functionality and explicitly set variable as buffer local. |
Date: |
Sat, 28 Nov 2020 00:33:13 -0500 (EST) |
branch: externals/vlf
commit 66db665d828f65442f1e27060de12b9d1c1c86c5
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Fix follow functionality and explicitly set variable as buffer local.
---
vlf-follow.el | 6 ++++--
vlf-occur.el | 2 +-
vlf.el | 20 +++++++++++---------
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/vlf-follow.el b/vlf-follow.el
index 2ff522a..1716faa 100644
--- a/vlf-follow.el
+++ b/vlf-follow.el
@@ -29,6 +29,7 @@
(defvar vlf-follow-timer nil
"Contains timer if vlf buffer is set to continuously recenter.")
+(make-variable-buffer-local 'vlf-follow-timer)
(put 'vlf-follow-timer 'permanent-local t)
(defun vlf-recenter (vlf-buffer)
@@ -57,8 +58,9 @@
(defun vlf-stop-follow ()
"Stop continuous recenter."
- (cancel-timer vlf-follow-timer)
- (setq vlf-follow-timer nil))
+ (when vlf-follow-timer
+ (cancel-timer vlf-follow-timer)
+ (setq vlf-follow-timer nil)))
(defun vlf-start-follow (interval)
"Continuously recenter chunk around point every INTERVAL seconds."
diff --git a/vlf-occur.el b/vlf-occur.el
index 64a35d0..b8e96e1 100644
--- a/vlf-occur.el
+++ b/vlf-occur.el
@@ -126,7 +126,7 @@ Prematurely ending indexing will still show what's found so
far."
(with-temp-buffer
(setq buffer-file-name file)
(set-buffer-modified-p nil)
- (set (make-local-variable 'vlf-batch-size) batch-size)
+ (setq-local vlf-batch-size batch-size)
(vlf-mode 1)
(goto-char (point-min))
(vlf-with-undo-disabled
diff --git a/vlf.el b/vlf.el
index 00bb085..467bece 100644
--- a/vlf.el
+++ b/vlf.el
@@ -51,12 +51,15 @@
;;; Keep track of file position.
(defvar vlf-start-pos 0
"Absolute position of the visible chunk start.")
+(make-variable-buffer-local 'vlf-start-pos)
(put 'vlf-start-pos 'permanent-local t)
(defvar vlf-end-pos 0 "Absolute position of the visible chunk end.")
+(make-variable-buffer-local 'vlf-end-pos)
(put 'vlf-end-pos 'permanent-local t)
(defvar vlf-file-size 0 "Total size of presented file.")
+(make-variable-buffer-local 'vlf-file-size)
(put 'vlf-file-size 'permanent-local t)
(autoload 'vlf-write "vlf-write" "Write current chunk to file.")
@@ -69,6 +72,8 @@
"Make whole file occur style index for REGEXP.")
(autoload 'vlf-toggle-follow "vlf-follow"
"Toggle continuous chunk recenter around current point.")
+(autoload 'vlf-stop-follow "vlf-follow"
+ "Stop continuous recenter.")
(defvar vlf-mode-map
(let ((map (make-sparse-keymap)))
@@ -112,22 +117,19 @@
:keymap vlf-prefix-map
(if vlf-mode
(progn
- (set (make-local-variable 'require-final-newline) nil)
+ (setq-local require-final-newline nil)
(add-hook 'write-file-functions 'vlf-write nil t)
- (set (make-local-variable 'revert-buffer-function)
- 'vlf-revert)
+ (setq-local revert-buffer-function 'vlf-revert)
(make-local-variable 'vlf-batch-size)
- (set (make-local-variable 'vlf-file-size)
- (vlf-get-file-size buffer-file-truename))
- (set (make-local-variable 'vlf-start-pos) 0)
- (set (make-local-variable 'vlf-end-pos) 0)
- (set (make-local-variable 'vlf-follow-timer) nil)
+ (setq vlf-file-size (vlf-get-file-size buffer-file-truename)
+ vlf-start-pos 0
+ vlf-end-pos 0)
(let* ((pos (position-bytes (point)))
(start (* (/ pos vlf-batch-size) vlf-batch-size)))
(goto-char (byte-to-position (- pos start)))
(vlf-move-to-batch start)))
(kill-local-variable 'revert-buffer-function)
- (vlf-stop-following)
+ (vlf-stop-follow)
(when (or (not large-file-warning-threshold)
(< vlf-file-size large-file-warning-threshold)
(y-or-n-p (format "Load whole file (%s)? "
- [elpa] externals/vlf 2ac3e7d 146/310: Fix prematurely ending search/occur not to ask for modified buffer, (continued)
- [elpa] externals/vlf 2ac3e7d 146/310: Fix prematurely ending search/occur not to ask for modified buffer, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 0080991 154/310: Fix chunk end adjustment and save for trunk Emacs., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a3901b8 157/310: Fix deletion when moving to partially overlapping chunk and enable more, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 371c560 158/310: Bump version and remove warning - save is now reliable., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf c68c34e 160/310: Add vlf-application customization which refines control over when, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a0cafa7 161/310: Explicitly offer vlf-prefix-map so user can easily define another prefix, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ea46386 168/310: Don't apply VLF by default over image and pdf files., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2470fc0 181/310: Fix vlf-shift-undo-list to reverse resulting list., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 161a4ec 184/310: Prevent inserting of too small file regions for GNU Emacs later than, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 95e6259 188/310: Add convenience macro to disable VLF application during execution of, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 66db665 189/310: Fix follow functionality and explicitly set variable as buffer local.,
Stefan Monnier <=
- [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, 2020/11/28