unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* eldoc support in hexl mode
@ 2004-02-09  7:27 Masatake YAMATO
  2004-02-17 13:24 ` Masatake YAMATO
  0 siblings, 1 reply; 3+ messages in thread
From: Masatake YAMATO @ 2004-02-09  7:27 UTC (permalink / raw)
  Cc: emacs-devel

I've written eldoc support in hexl mode.
With my patch, the address of the point in hexl mode buffer
is displayed real time.

Masatake YAMATO

2004-02-09  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.

Index: lisp/hexl.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/hexl.el,v
retrieving revision 1.83
diff -u -r1.83 hexl.el
--- lisp/hexl.el	8 Feb 2004 22:36:31 -0000	1.83
+++ lisp/hexl.el	9 Feb 2004 07:17:46 -0000
@@ -42,6 +42,8 @@
 
 ;;; Code:
 
+(require 'eldoc)
+
 ;;
 ;; vars here
 ;;
@@ -236,6 +238,13 @@
 
     (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,8 +370,14 @@
 		 (- 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."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: eldoc support in hexl mode
  2004-02-09  7:27 eldoc support in hexl mode Masatake YAMATO
@ 2004-02-17 13:24 ` Masatake YAMATO
  2004-03-04 18:23   ` Masatake YAMATO
  0 siblings, 1 reply; 3+ messages in thread
From: Masatake YAMATO @ 2004-02-17 13:24 UTC (permalink / raw)


> I've written eldoc support in hexl mode.
> With my patch, the address of the point in hexl mode buffer
> is displayed real time.
> 
> Masatake YAMATO
> 
> 2004-02-09  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.

No objection to install to the CVS repository?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: eldoc support in hexl mode
  2004-02-17 13:24 ` Masatake YAMATO
@ 2004-03-04 18:23   ` Masatake YAMATO
  0 siblings, 0 replies; 3+ messages in thread
From: Masatake YAMATO @ 2004-03-04 18:23 UTC (permalink / raw)


> > I've written eldoc support in hexl mode.
> > With my patch, the address of the point in hexl mode buffer
> > is displayed real time.
> > 
> > Masatake YAMATO
> > 
> > 2004-02-09  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.
> 
> No objection to install to the CVS repository?

I've got no approval nor objection, I've just installed.

Masatake YAMATO

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-03-04 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-09  7:27 eldoc support in hexl mode Masatake YAMATO
2004-02-17 13:24 ` Masatake YAMATO
2004-03-04 18:23   ` Masatake YAMATO

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).