[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf c68c34e 160/310: Add vlf-application customization
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf c68c34e 160/310: Add vlf-application customization which refines control over when |
Date: |
Sat, 28 Nov 2020 00:33:07 -0500 (EST) |
branch: externals/vlf
commit c68c34ea90b8cb0d7b3135e5fff984be48b17d30
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Add vlf-application customization which refines control over when
vlf-mode is automatically invoked or offered.
---
vlf.el | 67 +++++++++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 44 insertions(+), 23 deletions(-)
diff --git a/vlf.el b/vlf.el
index adcdad9..dfa4341 100644
--- a/vlf.el
+++ b/vlf.el
@@ -45,10 +45,23 @@
(defcustom vlf-batch-size 1024
"Defines how large each batch of file data is (in bytes)."
- :type 'integer
- :group 'vlf)
+ :group 'vlf
+ :type 'integer)
(put 'vlf-batch-size 'permanent-local t)
+;;;###autoload
+(defcustom vlf-application 'default
+ "Determines when `vlf' will be offered on opening files.
+Possible values are: nil to never use it;
+`default' 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 " default)
+ (const :format "%v " dont-ask)
+ (const :format "%v" always)))
+
;;; Keep track of file position.
(defvar vlf-start-pos 0
"Absolute position of the visible chunk start.")
@@ -150,28 +163,36 @@ You can customize number of bytes displayed by customizing
"If file SIZE larger than `large-file-warning-threshold', \
allow user to view file with `vlf', open it normally, or abort.
OP-TYPE specifies the file operation being performed over FILENAME."
- (and large-file-warning-threshold size
- (> size large-file-warning-threshold)
- (let ((char nil))
- (while (not (memq (setq char
- (read-event
- (propertize
- (format
- "File %s is large (%s): \
+ (cond
+ ((not vlf-application)
+ ad-do-it)
+ ((eq vlf-application 'always)
+ (vlf filename)
+ (error ""))
+ ((and large-file-warning-threshold
+ (> size large-file-warning-threshold))
+ (if (eq vlf-application 'dont-ask)
+ (progn (vlf filename)
+ (error ""))
+ (let ((char nil))
+ (while (not (memq (setq char
+ (read-event
+ (propertize
+ (format
+ "File %s is large (%s): \
%s normally (o), %s with vlf (v) or abort (a)"
- (if filename
- (file-name-nondirectory filename)
- "")
- (file-size-human-readable size)
- op-type op-type)
- 'face 'minibuffer-prompt)))
- '(?o ?O ?v ?V ?a ?A))))
- (cond ((memq char '(?o ?O)))
- ((memq char '(?v ?V))
- (vlf filename)
- (error ""))
- ((memq char '(?a ?A))
- (error "Aborted"))))))
+ (if filename
+ (file-name-nondirectory filename)
+ "")
+ (file-size-human-readable size)
+ op-type op-type)
+ 'face 'minibuffer-prompt)))
+ '(?o ?O ?v ?V ?a ?A))))
+ (cond ((memq char '(?v ?V))
+ (vlf filename)
+ (error ""))
+ ((memq char '(?a ?A))
+ (error "Aborted"))))))))
;; scroll auto batching
- [elpa] externals/vlf 4c631bc 129/310: Rename vlfi.el to vlf.el., (continued)
- [elpa] externals/vlf 4c631bc 129/310: Rename vlfi.el to vlf.el., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 17c6612 130/310: Rename anything vlfi -> vlf., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf bc68eed 131/310: Add dummy vlfi.el that urges move to the vlf package., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 025399a 133/310: Merge branch 'master' into keep-edit, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f34986a 142/310: Update README., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 931ca52 145/310: Stylistic refinements., Stefan Monnier, 2020/11/28
- [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 <=
- [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, 2020/11/28
- [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