emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vlf 4d82c78 197/310: - don't nullify default buffer cod


From: Stefan Monnier
Subject: [elpa] externals/vlf 4d82c78 197/310: - don't nullify default buffer coding system
Date: Sat, 28 Nov 2020 00:33:14 -0500 (EST)

branch: externals/vlf
commit 4d82c781b81adda6535e44a163f9cb9bf8102734
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>

    - don't nullify default buffer coding system
    - make vlf return the newly created VLF buffer
    - simplify beginning and end jumps
---
 vlf.el | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/vlf.el b/vlf.el
index 9284f76..c567854 100644
--- a/vlf.el
+++ b/vlf.el
@@ -122,12 +122,13 @@
 You can customize number of bytes displayed by customizing
 `vlf-batch-size'."
   (interactive "fFile to open: ")
-  (with-current-buffer (generate-new-buffer "*vlf*")
+  (let ((vlf-buffer (generate-new-buffer "*vlf*")))
+    (set-buffer vlf-buffer)
     (set-visited-file-name file)
     (set-buffer-modified-p nil)
-    (setq buffer-file-coding-system nil)
     (vlf-mode 1)
-    (switch-to-buffer (current-buffer))))
+    (switch-to-buffer vlf-buffer)
+    vlf-buffer))
 
 (defun vlf-next-batch (append)
   "Display the next batch of file data.
@@ -189,26 +190,15 @@ with the prefix argument DECREASE it is halved."
                          (* vlf-batch-size 2)))
   (vlf-move-to-batch vlf-start-pos))
 
-(defun vlf-insert-file (&optional from-end)
-  "Insert first chunk of current file contents in current buffer.
-With FROM-END prefix, start from the back."
-  (let ((start 0)
-        (end vlf-batch-size))
-    (if from-end
-        (setq start (- vlf-file-size vlf-batch-size)
-              end vlf-file-size)
-      (setq end (min vlf-batch-size vlf-file-size)))
-    (vlf-move-to-chunk start end)))
-
 (defun vlf-beginning-of-file ()
   "Jump to beginning of file content."
   (interactive)
-  (vlf-insert-file))
+  (vlf-move-to-batch 0))
 
 (defun vlf-end-of-file ()
   "Jump to end of file content."
   (interactive)
-  (vlf-insert-file t))
+  (vlf-move-to-batch vlf-file-size))
 
 (defun vlf-revert (&optional _ignore-auto noconfirm)
   "Revert current chunk.  Ignore _IGNORE-AUTO.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]