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

Completely decouple vlf integration from other functionality.

This commit is contained in:
Andrey Kotlarski 2014-01-07 01:47:39 +02:00
parent 66db665d82
commit 0dc6d0643e
3 changed files with 23 additions and 8 deletions

View File

@ -47,7 +47,13 @@ integer value).
** Applicability
You can control when vlf-mode is invoked or offered as choice with the
To have *vlf* offered as choice when opening large files:
#+BEGIN_EXAMPLE
(require 'vlf-integrate)
#+END_EXAMPLE
You can control when vlf-mode is invoked or offered with the
*vlf-application* customization option. By default it will offer VLF
when opening large files. There are also options to never use it (you
can still call *vlf* command explicitly); to use it without asking for
@ -70,7 +76,7 @@ To disable automatic usage of VLF for a function, for example named
*func* defined in file *file.el*:
#+BEGIN_EXAMPLE
(vlf-disable-for-function func "file.el")
(vlf-disable-for-function func "file")
#+END_EXAMPLE
** Keymap

View File

@ -35,6 +35,11 @@
(t ;; TODO: use (< emacs-minor-version 4) after 24.4 release
(string-lessp emacs-version "24.3.5")))
"Indicates whether partial decode codes are displayed.")
(unless (fboundp 'file-size-human-readable)
(defun file-size-human-readable (file-size)
"Print FILE-SIZE in MB."
(format "%.3fMB" (/ file-size 1048576.0))))
(defun vlf-move-to-chunk (start end &optional minimal)
"Move to chunk determined by START END.

16
vlf.el
View File

@ -26,10 +26,12 @@
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; This package provides the M-x vlf command, which visits part of a
;; large file without loading the entire file.
;; The buffer uses VLF mode, which defines several commands for
;; This package provides the M-x vlf command, which visits part of
;; large file without loading it entirely.
;; The buffer uses VLF mode, which provides several commands for
;; moving around, searching and editing selected part of file.
;; To have it offered when opening large files:
;; (require 'vlf-integrate)
;; This package was inspired by a snippet posted by Kevin Rodgers,
;; showing how to use `insert-file-contents' to extract part of a
@ -37,11 +39,13 @@
;;; Code:
;;;###autoload
(require 'vlf-integrate)
(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