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

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

[elpa] externals/vlf ee19f81 228/310: Load hexl advices after load and m


From: Stefan Monnier
Subject: [elpa] externals/vlf ee19f81 228/310: Load hexl advices after load and move vlf group definition.
Date: Sat, 28 Nov 2020 00:33:21 -0500 (EST)

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

    Load hexl advices after load and move vlf group definition.
---
 vlf-base.el |  3 ---
 vlf.el      | 51 ++++++++++++++++++++++++++++-----------------------
 2 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/vlf-base.el b/vlf-base.el
index 21dfbac..98b6831 100644
--- a/vlf-base.el
+++ b/vlf-base.el
@@ -27,9 +27,6 @@
 
 ;;; Code:
 
-(defgroup vlf nil "View Large Files in Emacs."
-  :prefix "vlf-" :group 'files)
-
 (defcustom vlf-batch-size 1024
   "Defines how large each batch of file data is (in bytes)."
   :group 'vlf :type 'integer)
diff --git a/vlf.el b/vlf.el
index 959c935..f90b770 100644
--- a/vlf.el
+++ b/vlf.el
@@ -39,6 +39,9 @@
 
 ;;; Code:
 
+(defgroup vlf nil "View Large Files in Emacs."
+  :prefix "vlf-" :group 'files)
+
 (defcustom vlf-before-batch-functions nil
   "Hook that runs before multiple batch operations.
 One argument is supplied that specifies current action.  Possible
@@ -222,29 +225,31 @@ When prefix argument is negative
 (add-hook 'vlf-before-chunk-update 'vlf-hexl-before)
 (add-hook 'vlf-after-chunk-update 'vlf-hexl-after)
 
-(defadvice hexl-save-buffer (around vlf-hexl-save
-                                    activate compile)
-  "Prevent hexl save if `vlf-mode' is active."
-  (if vlf-mode
-      (vlf-write)
-    ad-do-it))
-
-(defadvice hexl-scroll-up (around vlf-hexl-scroll-up
-                                  activate compile)
-  "Slide to next batch if at end of buffer in `vlf-mode'."
-  (if (and vlf-mode (pos-visible-in-window-p (point-max))
-           (or (not (numberp arg)) (< 0 arg)))
-      (progn (vlf-next-batch 1)
-             (goto-char (point-min)))
-    ad-do-it))
-
-(defadvice hexl-scroll-down (around vlf-hexl-scroll-down
-                                    activate compile)
-  "Slide to previous batch if at beginning of buffer in `vlf-mode'."
-  (if (and vlf-mode (pos-visible-in-window-p (point-min)))
-      (progn (vlf-prev-batch 1)
-             (goto-char (point-max)))
-    ad-do-it))
+(eval-after-load "hexl"
+  '(progn
+     (defadvice hexl-save-buffer (around vlf-hexl-save
+                                         activate compile)
+       "Prevent hexl save if `vlf-mode' is active."
+       (if vlf-mode
+           (vlf-write)
+         ad-do-it))
+
+     (defadvice hexl-scroll-up (around vlf-hexl-scroll-up
+                                       activate compile)
+       "Slide to next batch if at end of buffer in `vlf-mode'."
+       (if (and vlf-mode (pos-visible-in-window-p (point-max))
+                (or (not (numberp arg)) (< 0 arg)))
+           (progn (vlf-next-batch 1)
+                  (goto-char (point-min)))
+         ad-do-it))
+
+     (defadvice hexl-scroll-down (around vlf-hexl-scroll-down
+                                         activate compile)
+       "Slide to previous batch if at beginning of buffer in `vlf-mode'."
+       (if (and vlf-mode (pos-visible-in-window-p (point-min)))
+           (progn (vlf-prev-batch 1)
+                  (goto-char (point-max)))
+         ad-do-it))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; utilities



reply via email to

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