Mercurial > emacs
changeset 75263:52494ef7ef07
(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.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Thu, 18 Jan 2007 03:21:08 +0000 |
parents | adf48aa4f8f4 |
children | 835ffd70154b |
files | lisp/hexl.el |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/hexl.el Thu Jan 18 03:20:57 2007 +0000 +++ b/lisp/hexl.el Thu Jan 18 03:21:08 2007 +0000 @@ -283,6 +283,7 @@ (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 @@ (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 @@ (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)