# HG changeset patch
# User Phillip Rulon <pjr@gnu.org>
# Date 939397352 0
# Node ID 776bf3692d9df6c4c905476e432507c628468eb3
# Parent  21ae9c3947c9dcbc75f1b788043dac95b32ac557
	* hexl.el (hexlify-buffer): Move point in proper range
	if it is too large.
	(hexl-after-revert-hook): Update hexl-max-address.
	(hexl-address-to-marker): Doc fix.

diff -r 21ae9c3947c9 -r 776bf3692d9d lisp/hexl.el
--- a/lisp/hexl.el	Fri Oct 08 15:39:20 1999 +0000
+++ b/lisp/hexl.el	Fri Oct 08 15:42:32 1999 +0000
@@ -251,6 +251,7 @@
   (run-hooks 'hexl-mode-hook))
 
 (defun hexl-after-revert-hook ()
+  (setq hexl-max-address (1- (buffer-size)))
   (hexlify-buffer)
   (set-buffer-modified-p nil))
 
@@ -349,7 +350,7 @@
     hexl-address))
 
 (defun hexl-address-to-marker (address)
-  "Return marker for ADDRESS."
+  "Return buffer position for ADDRESS."
   (interactive "nAddress: ")
   (+ (* (/ address 16) 68) 11 (/ (* (% address 16) 5) 2)))
 
@@ -611,7 +612,9 @@
 		  'raw-text-unix)
 		 (t 'no-conversion))))
 	(buffer-undo-list t))
-    (shell-command-on-region (point-min) (point-max) hexlify-command t)))
+    (shell-command-on-region (point-min) (point-max) hexlify-command t)
+    (if (> (point) (hexl-address-to-marker hexl-max-address))
+	(hexl-goto-address hexl-max-address))))
 
 (defun dehexlify-buffer ()
   "Convert a hexl format buffer to binary.