[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf 30e4959 019/310: Add direct jumps to first and last
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf 30e4959 019/310: Add direct jumps to first and last chunks. |
Date: |
Sat, 28 Nov 2020 00:32:38 -0500 (EST) |
branch: externals/vlf
commit 30e495901b9b13a18063302f7b728d20cfbcfe68
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Add direct jumps to first and last chunks.
---
vlfi.el | 48 +++++++++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 19 deletions(-)
diff --git a/vlfi.el b/vlfi.el
index 537fcbe..ffeef2e 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -63,6 +63,12 @@
(vlfi-change-batch-size t)))
(define-key map "\C-c\C-s" 'vlfi-re-search-forward)
(define-key map "\C-c\C-r" 'vlfi-re-search-backward)
+ (define-key map "\C-c>" (lambda () "Jump to end of file content."
+ (interactive)
+ (vlfi-insert-file buffer-file-name t)))
+ (define-key map "\C-c<" (lambda () "Jump to beginning of file content."
+ (interactive)
+ (vlfi-insert-file buffer-file-name)))
map)
"Keymap for `vlfi-mode'.")
@@ -156,29 +162,33 @@ When prefix argument is negative
(set-buffer-modified-p nil)
(vlfi-update-buffer-name))
+(defun vlfi-insert-file (file &optional from-end)
+ "Insert first chunk of FILE contents in current buffer.
+With FROM-END prefix, start from the back."
+ (if from-end
+ (setq vlfi-start-pos (max 0 (- vlfi-file-size vlfi-batch-size))
+ vlfi-end-pos vlfi-file-size)
+ (setq vlfi-start-pos 0
+ vlfi-end-pos (min vlfi-batch-size vlfi-file-size)))
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (insert-file-contents buffer-file-name nil
+ vlfi-start-pos vlfi-end-pos))
+ (set-buffer-modified-p nil)
+ (vlfi-update-buffer-name))
+
;;;###autoload
-(defun vlfi (from-end file)
- "View a Large File in Emacs.
-With FROM-END prefix, view from the back.
-FILE is the file to open.
-Batches of the file data from FILE will be displayed in a
- read-only buffer.
-You can customize the number of bytes to
- display by customizing `vlfi-batch-size'."
- (interactive "P\nfFile to open: ")
+(defun vlfi (file &optional from-end)
+ "View Large FILE. With FROM-END prefix, view from the back.
+Batches of the file data from FILE will be displayed in a read-only
+buffer. You can customize number of bytes displayed by customizing
+`vlfi-batch-size'."
+ (interactive "fFile to open: \nP")
(with-current-buffer (generate-new-buffer "*vlfi*")
(buffer-disable-undo)
(setq buffer-file-name file
vlfi-file-size (nth 7 (file-attributes file)))
- (if from-end
- (setq vlfi-start-pos (max 0
- (- vlfi-file-size vlfi-batch-size))
- vlfi-end-pos vlfi-file-size)
- (setq vlfi-start-pos 0
- vlfi-end-pos (min vlfi-batch-size vlfi-file-size)))
- (vlfi-update-buffer-name)
- (insert-file-contents buffer-file-name nil
- vlfi-start-pos vlfi-end-pos)
+ (vlfi-insert-file file from-end)
(vlfi-mode)
(switch-to-buffer (current-buffer))))
@@ -187,7 +197,7 @@ You can customize the number of bytes to
"In Dired, visit the file on this line in VLFI mode.
With FROM-END prefix, view from the back."
(interactive "P")
- (vlfi from-end (dired-get-file-for-visit)))
+ (vlfi (dired-get-file-for-visit) from-end))
;;;###autoload
(eval-after-load "dired"
- [elpa] externals/vlf a0b8d5f 115/310: Merge pull request #3 from danlamanna/master, (continued)
- [elpa] externals/vlf a0b8d5f 115/310: Merge pull request #3 from danlamanna/master, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8ed9192 117/310: Review fixes:, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 298d8f5 118/310: Keep track of current batch encoded size and allow fluctuation when, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 563d9ca 119/310: Fix vlfi-revert to revert on user confirmation., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 34dfbd2 121/310: Use set-visited-file-name and abstract getting current file size and, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 6a1919d 001/310: Initial commit - original state of GNU ELPA vlf.el., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2d0709b 003/310: Improvements to the existing functionality:, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 59d5d2c 008/310: Add lexical-bind declaration., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 782b7e4 009/310: Make filename argument of `vlf-if-file-too-large' optional so it at, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 375c96f 018/310: Add backward whole file search., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 30e4959 019/310: Add direct jumps to first and last chunks.,
Stefan Monnier <=
- [elpa] externals/vlf 42693f6 026/310: Update README., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ac382e9 032/310: Add temporary highlight of match., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 9abee04 038/310: Merge branch 'master' into edit, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 0ff2f3e 040/310: Merge branch 'master' into edit, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 1948f3e 041/310: Make VLFI edit mode actually working., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 5405a30 045/310: Intercept buffer saving with vlfi-write., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f3132c0 044/310: Keep current position when moving around chunks., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8787186 055/310: Show paging according to batch size instead of percentage., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8f6299c 056/310: Simplify detection of buffer size change., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f23262e 057/310: Add shift back of file contents when edited chunk shrinks in size., Stefan Monnier, 2020/11/28