diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2007-01-18 03:21:08 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2007-01-18 03:21:08 +0000 |
commit | f77c618f8e3544ce8bf5aca93aa76bf775ea0caf (patch) | |
tree | a1e3253aa403d20975407148704a9e16fd3a3050 /lisp/hexl.el | |
parent | 66d237e2f91c2b81518677c574ca7bbb6fd9af08 (diff) | |
download | emacs-f77c618f8e3544ce8bf5aca93aa76bf775ea0caf.tar.gz |
(hexl-before-revert-hook): New function.
(hexl-mode): Use it.
(hexl-after-revert-hook): Just call hexl-mode.
(hexl-mode-exit): Remove before-revert-hook.
Diffstat (limited to 'lisp/hexl.el')
-rw-r--r-- | lisp/hexl.el | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/hexl.el b/lisp/hexl.el index cf678600680..35d68216162 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el @@ -283,6 +283,7 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode. (setq font-lock-defaults '(hexl-font-lock-keywords t)) ;; Add hooks to rehexlify or dehexlify on various events. + (add-hook 'before-revert-hook 'hexl-before-revert-hook nil t) (add-hook 'after-revert-hook 'hexl-after-revert-hook nil t) (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) @@ -317,10 +318,11 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode. (let ((isearch-search-fun-function nil)) (isearch-search-fun)))) +(defun hexl-before-revert-hook () + (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t)) + (defun hexl-after-revert-hook () - (setq hexl-max-address (1- (buffer-size))) - (hexlify-buffer) - (set-buffer-modified-p nil)) + (hexl-mode)) (defvar hexl-in-save-buffer nil) @@ -386,6 +388,7 @@ With arg, don't unhexlify buffer." (or (bobp) (setq original-point (1+ original-point)))) (goto-char original-point))) + (remove-hook 'before-revert-hook 'hexl-before-revert-hook t) (remove-hook 'after-revert-hook 'hexl-after-revert-hook t) (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t) (remove-hook 'post-command-hook 'hexl-follow-ascii-find t) |