]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/vlf/vlf-integrate.el
Merge commit '3abcd90ddc2f446ddf0fb874dd79ba870c26ad2d' from js2-mode
[gnu-emacs-elpa] / packages / vlf / vlf-integrate.el
index c0723987902bc088e3da010727b2017673e511db..7bc8f94752e75f57ae3195c5a36254f6e99f78fb 100644 (file)
 
 ;;; Code:
 
-(defgroup vlf nil
-  "View Large Files in Emacs."
-  :prefix "vlf-"
-  :group 'files)
+(defgroup vlf nil "View Large Files in Emacs."
+  :prefix "vlf-" :group 'files)
+
+(defcustom vlf-batch-size 1000000
+  "Defines how large each batch of file data initially is (in bytes)."
+  :group 'vlf :type 'integer)
 
 (defcustom vlf-application 'ask
   "Determines when `vlf' will be offered on opening files.
@@ -37,18 +39,16 @@ Possible values are: nil to never use it;
 `ask' offer `vlf' when file size is beyond `large-file-warning-threshold';
 `dont-ask' automatically use `vlf' for large files;
 `always' use `vlf' for all files."
-  :group 'vlf
-  :type '(radio (const :format "%v " nil)
-                (const :format "%v " ask)
-                (const :format "%v " dont-ask)
-                (const :format "%v" always)))
+  :group 'vlf :type '(radio (const :format "%v " nil)
+                            (const :format "%v " ask)
+                            (const :format "%v " dont-ask)
+                            (const :format "%v" always)))
 
 (defcustom vlf-forbidden-modes-list
   '(archive-mode tar-mode jka-compr git-commit-mode image-mode
                  doc-view-mode doc-view-mode-maybe ebrowse-tree-mode)
   "Major modes which VLF will not be automatically applied to."
-  :group 'vlf
-  :type '(list symbol))
+  :group 'vlf :type '(list symbol))
 
 (unless (fboundp 'file-size-human-readable)
   (defun file-size-human-readable (file-size)
@@ -102,7 +102,8 @@ OP-TYPE specifies the file operation being performed over FILENAME."
     (vlf filename)
     (error ""))
    ((and large-file-warning-threshold
-         (< large-file-warning-threshold size))
+         (< large-file-warning-threshold size)
+         (< vlf-batch-size size))
     (if (eq vlf-application 'dont-ask)
         (progn (vlf filename)
                (error ""))