mirror of
https://github.com/m00natic/vlfi.git
synced 2025-01-18 20:10:47 +00:00
Fix installation interfile dependencies and fix setting of local
variables for GNU Emasc 23.
This commit is contained in:
parent
dd43af51ff
commit
9343095096
25
vlf-base.el
25
vlf-base.el
@ -27,6 +27,31 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(defgroup vlf nil
|
||||||
|
"View Large Files in Emacs."
|
||||||
|
:prefix "vlf-"
|
||||||
|
:group 'files)
|
||||||
|
|
||||||
|
(defcustom vlf-batch-size 1024
|
||||||
|
"Defines how large each batch of file data is (in bytes)."
|
||||||
|
:group 'vlf
|
||||||
|
:type 'integer)
|
||||||
|
(put 'vlf-batch-size 'permanent-local t)
|
||||||
|
|
||||||
|
;;; 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)
|
||||||
|
|
||||||
(defconst vlf-sample-size 24
|
(defconst vlf-sample-size 24
|
||||||
"Minimal number of bytes that can be properly decoded.")
|
"Minimal number of bytes that can be properly decoded.")
|
||||||
|
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(eval-when-compile
|
||||||
|
(add-to-list 'load-path default-directory))
|
||||||
|
|
||||||
|
(require 'vlf)
|
||||||
|
|
||||||
(defvar vlf-follow-timer nil
|
(defvar vlf-follow-timer nil
|
||||||
"Contains timer if vlf buffer is set to continuously recenter.")
|
"Contains timer if vlf buffer is set to continuously recenter.")
|
||||||
(make-variable-buffer-local 'vlf-follow-timer)
|
(make-variable-buffer-local 'vlf-follow-timer)
|
||||||
|
@ -84,6 +84,8 @@ Possible values are: nil to never use it;
|
|||||||
(cadr mode)
|
(cadr mode)
|
||||||
mode)))
|
mode)))
|
||||||
|
|
||||||
|
(autoload 'vlf "vlf" "View Large FILE in batches.")
|
||||||
|
|
||||||
(defadvice abort-if-file-too-large (around vlf-if-file-too-large
|
(defadvice abort-if-file-too-large (around vlf-if-file-too-large
|
||||||
compile activate)
|
compile activate)
|
||||||
"If file SIZE larger than `large-file-warning-threshold', \
|
"If file SIZE larger than `large-file-warning-threshold', \
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(eval-when-compile
|
||||||
|
(add-to-list 'load-path default-directory))
|
||||||
|
|
||||||
|
(require 'vlf)
|
||||||
|
|
||||||
(defvar vlf-occur-mode-map
|
(defvar vlf-occur-mode-map
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(define-key map "n" 'vlf-occur-next-match)
|
(define-key map "n" 'vlf-occur-next-match)
|
||||||
@ -126,7 +131,7 @@ Prematurely ending indexing will still show what's found so far."
|
|||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(setq buffer-file-name file)
|
(setq buffer-file-name file)
|
||||||
(set-buffer-modified-p nil)
|
(set-buffer-modified-p nil)
|
||||||
(setq-local vlf-batch-size batch-size)
|
(set (make-local-variable 'vlf-batch-size) batch-size)
|
||||||
(vlf-mode 1)
|
(vlf-mode 1)
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(vlf-with-undo-disabled
|
(vlf-with-undo-disabled
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(eval-when-compile
|
||||||
|
(add-to-list 'load-path default-directory))
|
||||||
|
|
||||||
|
(require 'vlf)
|
||||||
|
|
||||||
(defun vlf-re-search (regexp count backward batch-step)
|
(defun vlf-re-search (regexp count backward batch-step)
|
||||||
"Search for REGEXP COUNT number of times forward or BACKWARD.
|
"Search for REGEXP COUNT number of times forward or BACKWARD.
|
||||||
BATCH-STEP is amount of overlap between successive chunks."
|
BATCH-STEP is amount of overlap between successive chunks."
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(eval-when-compile
|
||||||
|
(add-to-list 'load-path default-directory))
|
||||||
|
|
||||||
|
(require 'vlf-base)
|
||||||
|
|
||||||
(defun vlf-write ()
|
(defun vlf-write ()
|
||||||
"Write current chunk to file. Always return true to disable save.
|
"Write current chunk to file. Always return true to disable save.
|
||||||
If changing size of chunk, shift remaining file content."
|
If changing size of chunk, shift remaining file content."
|
||||||
|
96
vlf.el
96
vlf.el
@ -39,33 +39,11 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(eval-when-compile
|
||||||
|
(add-to-list 'load-path default-directory))
|
||||||
|
|
||||||
(require 'vlf-base)
|
(require 'vlf-base)
|
||||||
|
|
||||||
(defgroup vlf nil
|
|
||||||
"View Large Files in Emacs."
|
|
||||||
:prefix "vlf-"
|
|
||||||
:group 'files)
|
|
||||||
|
|
||||||
(defcustom vlf-batch-size 1024
|
|
||||||
"Defines how large each batch of file data is (in bytes)."
|
|
||||||
:group 'vlf
|
|
||||||
:type 'integer)
|
|
||||||
(put 'vlf-batch-size 'permanent-local t)
|
|
||||||
|
|
||||||
;;; 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.")
|
(autoload 'vlf-write "vlf-write" "Write current chunk to file.")
|
||||||
(autoload 'vlf-re-search-forward "vlf-search"
|
(autoload 'vlf-re-search-forward "vlf-search"
|
||||||
"Search forward for REGEXP prefix COUNT number of times.")
|
"Search forward for REGEXP prefix COUNT number of times.")
|
||||||
@ -114,9 +92,10 @@
|
|||||||
:keymap vlf-prefix-map
|
:keymap vlf-prefix-map
|
||||||
(if vlf-mode
|
(if vlf-mode
|
||||||
(progn
|
(progn
|
||||||
(setq-local require-final-newline nil)
|
(set (make-local-variable 'require-final-newline) nil)
|
||||||
(add-hook 'write-file-functions 'vlf-write nil t)
|
(add-hook 'write-file-functions 'vlf-write nil t)
|
||||||
(setq-local revert-buffer-function 'vlf-revert)
|
(set (make-local-variable 'revert-buffer-function)
|
||||||
|
'vlf-revert)
|
||||||
(make-local-variable 'vlf-batch-size)
|
(make-local-variable 'vlf-batch-size)
|
||||||
(setq vlf-file-size (vlf-get-file-size buffer-file-truename)
|
(setq vlf-file-size (vlf-get-file-size buffer-file-truename)
|
||||||
vlf-start-pos 0
|
vlf-start-pos 0
|
||||||
@ -153,6 +132,36 @@ You can customize number of bytes displayed by customizing
|
|||||||
(vlf-mode 1)
|
(vlf-mode 1)
|
||||||
(switch-to-buffer (current-buffer))))
|
(switch-to-buffer (current-buffer))))
|
||||||
|
|
||||||
|
(defun vlf-next-batch (append)
|
||||||
|
"Display the next batch of file data.
|
||||||
|
When prefix argument is supplied and positive
|
||||||
|
jump over APPEND number of batches.
|
||||||
|
When prefix argument is negative
|
||||||
|
append next APPEND number of batches to the existing buffer."
|
||||||
|
(interactive "p")
|
||||||
|
(vlf-verify-size)
|
||||||
|
(let* ((end (min (+ vlf-end-pos (* vlf-batch-size (abs append)))
|
||||||
|
vlf-file-size))
|
||||||
|
(start (if (< append 0)
|
||||||
|
vlf-start-pos
|
||||||
|
(- end vlf-batch-size))))
|
||||||
|
(vlf-move-to-chunk start end)))
|
||||||
|
|
||||||
|
(defun vlf-prev-batch (prepend)
|
||||||
|
"Display the previous batch of file data.
|
||||||
|
When prefix argument is supplied and positive
|
||||||
|
jump over PREPEND number of batches.
|
||||||
|
When prefix argument is negative
|
||||||
|
append previous PREPEND number of batches to the existing buffer."
|
||||||
|
(interactive "p")
|
||||||
|
(if (zerop vlf-start-pos)
|
||||||
|
(error "Already at BOF"))
|
||||||
|
(let* ((start (max 0 (- vlf-start-pos (* vlf-batch-size (abs prepend)))))
|
||||||
|
(end (if (< prepend 0)
|
||||||
|
vlf-end-pos
|
||||||
|
(+ start vlf-batch-size))))
|
||||||
|
(vlf-move-to-chunk start end)))
|
||||||
|
|
||||||
;; scroll auto batching
|
;; scroll auto batching
|
||||||
(defadvice scroll-up (around vlf-scroll-up
|
(defadvice scroll-up (around vlf-scroll-up
|
||||||
activate compile)
|
activate compile)
|
||||||
@ -225,39 +234,6 @@ Ask for confirmation if NOCONFIRM is nil."
|
|||||||
(error "Save or discard your changes first")
|
(error "Save or discard your changes first")
|
||||||
t))
|
t))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;;; batch movement
|
|
||||||
|
|
||||||
(defun vlf-next-batch (append)
|
|
||||||
"Display the next batch of file data.
|
|
||||||
When prefix argument is supplied and positive
|
|
||||||
jump over APPEND number of batches.
|
|
||||||
When prefix argument is negative
|
|
||||||
append next APPEND number of batches to the existing buffer."
|
|
||||||
(interactive "p")
|
|
||||||
(vlf-verify-size)
|
|
||||||
(let* ((end (min (+ vlf-end-pos (* vlf-batch-size (abs append)))
|
|
||||||
vlf-file-size))
|
|
||||||
(start (if (< append 0)
|
|
||||||
vlf-start-pos
|
|
||||||
(- end vlf-batch-size))))
|
|
||||||
(vlf-move-to-chunk start end)))
|
|
||||||
|
|
||||||
(defun vlf-prev-batch (prepend)
|
|
||||||
"Display the previous batch of file data.
|
|
||||||
When prefix argument is supplied and positive
|
|
||||||
jump over PREPEND number of batches.
|
|
||||||
When prefix argument is negative
|
|
||||||
append previous PREPEND number of batches to the existing buffer."
|
|
||||||
(interactive "p")
|
|
||||||
(if (zerop vlf-start-pos)
|
|
||||||
(error "Already at BOF"))
|
|
||||||
(let* ((start (max 0 (- vlf-start-pos (* vlf-batch-size (abs prepend)))))
|
|
||||||
(end (if (< prepend 0)
|
|
||||||
vlf-end-pos
|
|
||||||
(+ start vlf-batch-size))))
|
|
||||||
(vlf-move-to-chunk start end)))
|
|
||||||
|
|
||||||
(defun vlf-move-to-batch (start &optional minimal)
|
(defun vlf-move-to-batch (start &optional minimal)
|
||||||
"Move to batch determined by START.
|
"Move to batch determined by START.
|
||||||
Adjust according to file start/end and show `vlf-batch-size' bytes.
|
Adjust according to file start/end and show `vlf-batch-size' bytes.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user