diff options
| author | Masatake YAMATO | 2004-03-04 18:19:19 +0000 |
|---|---|---|
| committer | Masatake YAMATO | 2004-03-04 18:19:19 +0000 |
| commit | 01ff91367762acf46e2e138ae6168d1e2db75002 (patch) | |
| tree | eca68799a5ab6fe811a1088f34af5362eb1f37ec | |
| parent | 04a6e76be8165b327da9055458645baa4653f405 (diff) | |
| download | emacs-01ff91367762acf46e2e138ae6168d1e2db75002.tar.gz emacs-01ff91367762acf46e2e138ae6168d1e2db75002.zip | |
(hexl-mode): Set `hexl-print-current-point-info' as the callback function for eldoc.
(hexl-print-current-point-info): New function.
(hexl-current-address): print the address in both decimal and hexadecimal format.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/hexl.el | 17 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9edcb1f6600..e8353eeea21 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2004-03-04 Masatake YAMATO <jet@gyve.org> | ||
| 2 | |||
| 3 | * hexl.el (hexl-mode): Set `hexl-print-current-point-info' | ||
| 4 | as the callback function for eldoc. | ||
| 5 | (hexl-print-current-point-info): New function. | ||
| 6 | (hexl-current-address): print the address in both decimal | ||
| 7 | and hexadecimal format. | ||
| 8 | |||
| 1 | 2004-03-04 Richard M. Stallman <rms@gnu.org> | 9 | 2004-03-04 Richard M. Stallman <rms@gnu.org> |
| 2 | 10 | ||
| 3 | * mail/rmail.el (rmail-convert-to-babyl-format): | 11 | * mail/rmail.el (rmail-convert-to-babyl-format): |
diff --git a/lisp/hexl.el b/lisp/hexl.el index 413344fc375..40e3c929c59 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el | |||
| @@ -42,6 +42,8 @@ | |||
| 42 | 42 | ||
| 43 | ;;; Code: | 43 | ;;; Code: |
| 44 | 44 | ||
| 45 | (require 'eldoc) | ||
| 46 | |||
| 45 | ;; | 47 | ;; |
| 46 | ;; vars here | 48 | ;; vars here |
| 47 | ;; | 49 | ;; |
| @@ -236,6 +238,13 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode. | |||
| 236 | 238 | ||
| 237 | (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) | 239 | (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) |
| 238 | 240 | ||
| 241 | ;; Set a callback function for eldoc. | ||
| 242 | (set (make-variable-buffer-local 'eldoc-print-current-symbol-info-function) | ||
| 243 | 'hexl-print-current-point-info) | ||
| 244 | (eldoc-add-command-completions "hexl-") | ||
| 245 | (eldoc-remove-command "hexl-save-buffer" | ||
| 246 | "hexl-current-address") | ||
| 247 | |||
| 239 | (if hexl-follow-ascii (hexl-follow-ascii 1))) | 248 | (if hexl-follow-ascii (hexl-follow-ascii 1))) |
| 240 | (run-hooks 'hexl-mode-hook)) | 249 | (run-hooks 'hexl-mode-hook)) |
| 241 | 250 | ||
| @@ -361,9 +370,15 @@ Ask the user for confirmation." | |||
| 361 | (- current-column 41) | 370 | (- current-column 41) |
| 362 | (/ (- current-column (/ current-column 5)) 2)))) | 371 | (/ (- current-column (/ current-column 5)) 2)))) |
| 363 | (when (interactive-p) | 372 | (when (interactive-p) |
| 364 | (message "Current address is %d" hexl-address)) | 373 | (message "Current address is %d/0x%08x" hexl-address hexl-address)) |
| 365 | hexl-address)) | 374 | hexl-address)) |
| 366 | 375 | ||
| 376 | (defun hexl-print-current-point-info () | ||
| 377 | "Return current hexl-address in string. | ||
| 378 | This function is indented to be used as eldoc callback." | ||
| 379 | (let ((addr (hexl-current-address))) | ||
| 380 | (format "Current address is %d/0x%08x" addr addr))) | ||
| 381 | |||
| 367 | (defun hexl-address-to-marker (address) | 382 | (defun hexl-address-to-marker (address) |
| 368 | "Return buffer position for ADDRESS." | 383 | "Return buffer position for ADDRESS." |
| 369 | (interactive "nAddress: ") | 384 | (interactive "nAddress: ") |