diff options
author | Masatake YAMATO <jet@gyve.org> | 2004-03-04 18:19:19 +0000 |
---|---|---|
committer | Masatake YAMATO <jet@gyve.org> | 2004-03-04 18:19:19 +0000 |
commit | 6e430b6779be02d12769dd11a4a29f03f8f09183 (patch) | |
tree | 3c077cdc771dd2c85cfc9a6d317099edac31485e /lisp/hexl.el | |
parent | 77f3904fdc30955a086090402adde127a25fab3c (diff) | |
download | emacs-6e430b6779be02d12769dd11a4a29f03f8f09183.tar.gz |
(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.
Diffstat (limited to 'lisp/hexl.el')
-rw-r--r-- | lisp/hexl.el | 17 |
1 files changed, 16 insertions, 1 deletions
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 @@ ;;; Code: +(require 'eldoc) + ;; ;; vars here ;; @@ -236,6 +238,13 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode. (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) + ;; Set a callback function for eldoc. + (set (make-variable-buffer-local 'eldoc-print-current-symbol-info-function) + 'hexl-print-current-point-info) + (eldoc-add-command-completions "hexl-") + (eldoc-remove-command "hexl-save-buffer" + "hexl-current-address") + (if hexl-follow-ascii (hexl-follow-ascii 1))) (run-hooks 'hexl-mode-hook)) @@ -361,9 +370,15 @@ Ask the user for confirmation." (- current-column 41) (/ (- current-column (/ current-column 5)) 2)))) (when (interactive-p) - (message "Current address is %d" hexl-address)) + (message "Current address is %d/0x%08x" hexl-address hexl-address)) hexl-address)) +(defun hexl-print-current-point-info () + "Return current hexl-address in string. +This function is indented to be used as eldoc callback." + (let ((addr (hexl-current-address))) + (format "Current address is %d/0x%08x" addr addr))) + (defun hexl-address-to-marker (address) "Return buffer position for ADDRESS." (interactive "nAddress: ") |