]> git.eshelyaron.com Git - emacs.git/commitdiff
(hexl-mode): Set `hexl-print-current-point-info' as the callback function for eldoc.
authorMasatake YAMATO <jet@gyve.org>
Thu, 4 Mar 2004 18:19:19 +0000 (18:19 +0000)
committerMasatake YAMATO <jet@gyve.org>
Thu, 4 Mar 2004 18:19:19 +0000 (18:19 +0000)
(hexl-print-current-point-info): New function.
(hexl-current-address): print the address in both decimal and hexadecimal format.

lisp/ChangeLog
lisp/hexl.el

index 9edcb1f6600a790bc81b57e905237d54e34e2b55..e8353eeea21499c899f92dec6c003fc20854fbb2 100644 (file)
@@ -1,3 +1,11 @@
+2004-03-04  Masatake YAMATO  <jet@gyve.org>
+
+       * hexl.el (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.
+
 2004-03-04  Richard M. Stallman  <rms@gnu.org>
 
        * mail/rmail.el (rmail-convert-to-babyl-format):
index 413344fc3755aa54d34f926e159536c41191e732..40e3c929c590d07bc94c5f1d9b54908f18579d16 100644 (file)
@@ -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: ")