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

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

[elpa] externals/vlf 3fb898e 070/310: Add automatic batching when scroll


From: Stefan Monnier
Subject: [elpa] externals/vlf 3fb898e 070/310: Add automatic batching when scrolling.
Date: Sat, 28 Nov 2020 00:32:49 -0500 (EST)

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

    Add automatic batching when scrolling.
---
 vlfi.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/vlfi.el b/vlfi.el
index 6bf37ca..aeccb17 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -146,6 +146,25 @@ OP-TYPE specifies the file operation being performed over 
FILENAME."
 ;;;###autoload
 (fset 'abort-if-file-too-large 'vlfi-if-file-too-large)
 
+;; scroll auto batching
+(defadvice scroll-up (around vlfi-scroll-up
+                             activate compile)
+  "Slide to next batch if at end of buffer in `vlfi-mode'."
+  (if (and (eq major-mode 'vlfi-mode)
+           (eobp))
+      (progn (vlfi-next-batch 1)
+             (goto-char (point-min)))
+    ad-do-it))
+
+(defadvice scroll-down (around vlfi-scroll-down
+                               activate compile)
+  "Slide to previous batch if at beginning of buffer  in `vlfi-mode'."
+  (if (and (eq major-mode 'vlfi-mode)
+           (bobp))
+      (progn (vlfi-prev-batch 1)
+             (goto-char (point-max)))
+    ad-do-it))
+
 ;; non recent Emacs
 (unless (fboundp 'file-size-human-readable)
   (defun file-size-human-readable (file-size)



reply via email to

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