[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf a0cafa7 161/310: Explicitly offer vlf-prefix-map so
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf a0cafa7 161/310: Explicitly offer vlf-prefix-map so user can easily define another prefix |
Date: |
Sat, 28 Nov 2020 00:33:07 -0500 (EST) |
branch: externals/vlf
commit a0cafa71eaad077095726d6370a2cd8a7186f6f1
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Explicitly offer vlf-prefix-map so user can easily define another prefix
for vlf-mode-map. Remove vlf-refresh and refine vlf-revert.
---
vlf.el | 47 +++++++++++++++++++++--------------------------
1 file changed, 21 insertions(+), 26 deletions(-)
diff --git a/vlf.el b/vlf.el
index dfa4341..5b46a4f 100644
--- a/vlf.el
+++ b/vlf.el
@@ -74,11 +74,10 @@ Possible values are: nil to never use it;
(put 'vlf-file-size 'permanent-local t)
(defvar vlf-mode-map
- (let ((map-prefix (make-sparse-keymap))
- (map (make-sparse-keymap)))
- (define-key map [next] 'vlf-next-batch)
- (define-key map [prior] 'vlf-prev-batch)
- (define-key map "n" 'vlf-next-batch-from-point)
+ (let ((map (make-sparse-keymap)))
+ (define-key map "n" 'vlf-next-batch)
+ (define-key map "p" 'vlf-prev-batch)
+ (define-key map " " 'vlf-next-batch-from-point)
(define-key map "+" 'vlf-change-batch-size)
(define-key map "-"
(lambda () "Decrease vlf batch size by factor of 2."
@@ -91,16 +90,21 @@ Possible values are: nil to never use it;
(define-key map "]" 'vlf-end-of-file)
(define-key map "j" 'vlf-jump-to-chunk)
(define-key map "l" 'vlf-goto-line)
- (define-key map "g" 'vlf-refresh)
- (define-key map-prefix "\C-c\C-v" map)
- map-prefix)
+ (define-key map "g" 'vlf-revert)
+ map)
"Keymap for `vlf-mode'.")
+(defvar vlf-prefix-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\C-c\C-v" vlf-mode-map)
+ map)
+ "Prefixed keymap for `vlf-mode'.")
+
(define-minor-mode vlf-mode
"Mode to browse large files in."
:lighter " VLF"
:group 'vlf
- :keymap vlf-mode-map
+ :keymap vlf-prefix-map
(if vlf-mode
(progn
(set (make-local-variable 'require-final-newline) nil)
@@ -275,10 +279,12 @@ With FROM-END prefix, start from the back."
(defun vlf-revert (&optional _ignore-auto noconfirm)
"Revert current chunk. Ignore _IGNORE-AUTO.
Ask for confirmation if NOCONFIRM is nil."
- (if (or noconfirm
- (yes-or-no-p (format "Revert buffer from file %s? "
- buffer-file-name)))
- (vlf-move-to-chunk-2 vlf-start-pos vlf-end-pos)))
+ (interactive)
+ (when (or noconfirm
+ (yes-or-no-p (format "Revert buffer from file %s? "
+ buffer-file-name)))
+ (set-buffer-modified-p nil)
+ (vlf-move-to-chunk-2 vlf-start-pos vlf-end-pos)))
(defun vlf-jump-to-chunk (n)
"Go to to chunk N."
@@ -311,8 +317,7 @@ 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)))
+ (let* ((end (min (+ vlf-end-pos (* vlf-batch-size (abs append)))
vlf-file-size))
(start (if (< append 0)
vlf-start-pos
@@ -328,8 +333,7 @@ When prefix argument is negative
(interactive "p")
(if (zerop vlf-start-pos)
(error "Already at BOF"))
- (let* ((start (max 0 (- vlf-start-pos (* vlf-batch-size
- (abs prepend)))))
+ (let* ((start (max 0 (- vlf-start-pos (* vlf-batch-size (abs prepend)))))
(end (if (< prepend 0)
vlf-end-pos
(+ start vlf-batch-size))))
@@ -902,15 +906,6 @@ in file: %s" total-matches line regexp file)
(display-buffer occur-buffer)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; editing
-
-(defun vlf-refresh ()
- "Discard edit and refresh chunk from file."
- (interactive)
- (set-buffer-modified-p nil)
- (vlf-move-to-chunk-2 vlf-start-pos vlf-end-pos))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; saving
(defun vlf-write ()
- [elpa] externals/vlf 17c6612 130/310: Rename anything vlfi -> vlf., (continued)
- [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, 2020/11/28
- [elpa] externals/vlf a0cafa7 161/310: Explicitly offer vlf-prefix-map so user can easily define another prefix,
Stefan Monnier <=
- [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
- [elpa] externals/vlf 9510c70 215/310: Retry decoding when the initial attempt seems wrong., Stefan Monnier, 2020/11/28