1
0
mirror of https://github.com/m00natic/vlfi.git synced 2025-01-19 04:20:47 +00:00

Load hexl advices after load and move vlf group definition.

This commit is contained in:
Andrey Kotlarski 2014-02-23 00:40:20 +02:00
parent 6476c1be6a
commit ee19f811ae
2 changed files with 26 additions and 24 deletions

View File

@ -27,9 +27,6 @@
;;; Code: ;;; Code:
(defgroup vlf nil "View Large Files in Emacs."
:prefix "vlf-" :group 'files)
(defcustom vlf-batch-size 1024 (defcustom vlf-batch-size 1024
"Defines how large each batch of file data is (in bytes)." "Defines how large each batch of file data is (in bytes)."
:group 'vlf :type 'integer) :group 'vlf :type 'integer)

47
vlf.el
View File

@ -39,6 +39,9 @@
;;; Code: ;;; Code:
(defgroup vlf nil "View Large Files in Emacs."
:prefix "vlf-" :group 'files)
(defcustom vlf-before-batch-functions nil (defcustom vlf-before-batch-functions nil
"Hook that runs before multiple batch operations. "Hook that runs before multiple batch operations.
One argument is supplied that specifies current action. Possible 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-before-chunk-update 'vlf-hexl-before)
(add-hook 'vlf-after-chunk-update 'vlf-hexl-after) (add-hook 'vlf-after-chunk-update 'vlf-hexl-after)
(defadvice hexl-save-buffer (around vlf-hexl-save (eval-after-load "hexl"
activate compile) '(progn
"Prevent hexl save if `vlf-mode' is active." (defadvice hexl-save-buffer (around vlf-hexl-save
(if vlf-mode activate compile)
(vlf-write) "Prevent hexl save if `vlf-mode' is active."
ad-do-it)) (if vlf-mode
(vlf-write)
ad-do-it))
(defadvice hexl-scroll-up (around vlf-hexl-scroll-up (defadvice hexl-scroll-up (around vlf-hexl-scroll-up
activate compile) activate compile)
"Slide to next batch if at end of buffer in `vlf-mode'." "Slide to next batch if at end of buffer in `vlf-mode'."
(if (and vlf-mode (pos-visible-in-window-p (point-max)) (if (and vlf-mode (pos-visible-in-window-p (point-max))
(or (not (numberp arg)) (< 0 arg))) (or (not (numberp arg)) (< 0 arg)))
(progn (vlf-next-batch 1) (progn (vlf-next-batch 1)
(goto-char (point-min))) (goto-char (point-min)))
ad-do-it)) ad-do-it))
(defadvice hexl-scroll-down (around vlf-hexl-scroll-down (defadvice hexl-scroll-down (around vlf-hexl-scroll-down
activate compile) activate compile)
"Slide to previous batch if at beginning of buffer in `vlf-mode'." "Slide to previous batch if at beginning of buffer in `vlf-mode'."
(if (and vlf-mode (pos-visible-in-window-p (point-min))) (if (and vlf-mode (pos-visible-in-window-p (point-min)))
(progn (vlf-prev-batch 1) (progn (vlf-prev-batch 1)
(goto-char (point-max))) (goto-char (point-max)))
ad-do-it)) ad-do-it))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; utilities ;;; utilities