# HG changeset patch # User Richard M. Stallman # Date 834426006 0 # Node ID 76072cbcae84c2e788c2b77becd4a4cced58c596 # Parent abcc218dcbbc9b9e5fb6ae08328e0df7115f0e29 (hexl-mode): Set hexl-max-address early on and call hexl-goto-address afterward. And call hexlify-buffer even earlier. diff -r abcc218dcbbc -r 76072cbcae84 lisp/hexl.el --- a/lisp/hexl.el Mon Jun 10 15:53:37 1996 +0000 +++ b/lisp/hexl.el Mon Jun 10 17:00:06 1996 +0000 @@ -163,6 +163,22 @@ (if (eq major-mode 'hexl-mode) (error "You are already in hexl mode") + (let ((modified (buffer-modified-p)) + (inhibit-read-only t) + (original-point (1- (point))) + max-address) + (and (eobp) (not (bobp)) + (setq original-point (1- original-point))) + (if (not (or (eq arg 1) (not arg))) + ;; if no argument then we guess at hexl-max-address + (setq max-address (+ (* (/ (1- (buffer-size)) 68) 16) 15)) + (setq max-address (1- (buffer-size))) + (hexlify-buffer) + (set-buffer-modified-p modified)) + (make-local-variable 'hexl-max-address) + (setq hexl-max-address max-address) + (hexl-goto-address original-point)) + ;; We do not turn off the old major mode; instead we just ;; override most of it. That way, we can restore it perfectly. (make-local-variable 'hexl-mode-old-local-map) @@ -197,21 +213,7 @@ (make-local-hook 'change-major-mode-hook) (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) - - (make-local-variable 'hexl-max-address) - - (let ((modified (buffer-modified-p)) - (inhibit-read-only t) - (original-point (1- (point)))) - (and (eobp) (not (bobp)) - (setq original-point (1- original-point))) - (if (not (or (eq arg 1) (not arg))) - ;; if no argument then we guess at hexl-max-address - (setq hexl-max-address (+ (* (/ (1- (buffer-size)) 68) 16) 15)) - (setq hexl-max-address (1- (buffer-size))) - (hexlify-buffer) - (set-buffer-modified-p modified) - (hexl-goto-address original-point))))) +)) (defun hexl-after-revert-hook () (hexlify-buffer)