comparison lisp/hexl.el @ 56080:33e0ec6d5662

(hexl-mode): Catch errors in hexl-goto-address.
author Richard M. Stallman <rms@gnu.org>
date Sun, 13 Jun 2004 21:58:41 +0000
parents 43fc3aaf85fa
children 0d6b8a784254 4c90ffeb71c5
comparison
equal deleted inserted replaced
56079:16a8650c3814 56080:33e0ec6d5662
215 (or (bolp) (setq original-point (1- original-point)))) 215 (or (bolp) (setq original-point (1- original-point))))
216 (hexlify-buffer) 216 (hexlify-buffer)
217 (set-buffer-modified-p modified)) 217 (set-buffer-modified-p modified))
218 (make-local-variable 'hexl-max-address) 218 (make-local-variable 'hexl-max-address)
219 (setq hexl-max-address max-address) 219 (setq hexl-max-address max-address)
220 (hexl-goto-address original-point)) 220 (condition-case nil
221 (hexl-goto-address original-point)
222 (error nil)))
221 223
222 ;; We do not turn off the old major mode; instead we just 224 ;; We do not turn off the old major mode; instead we just
223 ;; override most of it. That way, we can restore it perfectly. 225 ;; override most of it. That way, we can restore it perfectly.
224 (make-local-variable 'hexl-mode-old-local-map) 226 (make-local-variable 'hexl-mode-old-local-map)
225 (setq hexl-mode-old-local-map (current-local-map)) 227 (setq hexl-mode-old-local-map (current-local-map))
403 (defun hexl-goto-address (address) 405 (defun hexl-goto-address (address)
404 "Goto hexl-mode (decimal) address ADDRESS. 406 "Goto hexl-mode (decimal) address ADDRESS.
405 Signal error if ADDRESS out of range." 407 Signal error if ADDRESS out of range."
406 (interactive "nAddress: ") 408 (interactive "nAddress: ")
407 (if (or (< address 0) (> address hexl-max-address)) 409 (if (or (< address 0) (> address hexl-max-address))
408 (error "Out of hexl region")) 410 (error "Out of hexl region"))
409 (goto-char (hexl-address-to-marker address))) 411 (goto-char (hexl-address-to-marker address)))
410 412
411 (defun hexl-goto-hex-address (hex-address) 413 (defun hexl-goto-hex-address (hex-address)
412 "Go to hexl-mode address (hex string) HEX-ADDRESS. 414 "Go to hexl-mode address (hex string) HEX-ADDRESS.
413 Signal error if HEX-ADDRESS is out of range." 415 Signal error if HEX-ADDRESS is out of range."