From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Masatake YAMATO Newsgroups: gmane.emacs.devel Subject: eldoc support in hexl mode Date: Mon, 09 Feb 2004 16:27:42 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <20040209.162742.112625647.jet@gyve.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1076311856 22170 80.91.224.253 (9 Feb 2004 07:30:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 Feb 2004 07:30:56 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Feb 09 08:30:46 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Aq5sU-0002us-00 for ; Mon, 09 Feb 2004 08:30:46 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Aq5sT-0004P0-00 for ; Mon, 09 Feb 2004 08:30:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Aq5qc-0007jR-Rs for emacs-devel@quimby.gnus.org; Mon, 09 Feb 2004 02:28:50 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1Aq5qA-0007iB-Tc for emacs-devel@gnu.org; Mon, 09 Feb 2004 02:28:22 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1Aq5pd-0007ET-Ic for emacs-devel@gnu.org; Mon, 09 Feb 2004 02:28:20 -0500 Original-Received: from [210.130.136.40] (helo=r-maa.spacetown.ne.jp) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Aq5pc-0007CJ-NJ; Mon, 09 Feb 2004 02:27:48 -0500 Original-Received: from localhost (nat-pool.jp.redhat.com [219.120.63.249]) by r-maa.spacetown.ne.jp (8.11.6) with ESMTP id i197RhG02066; Mon, 9 Feb 2004 16:27:43 +0900 (JST) Original-To: fx@gnu.org X-Mailer: Mew version 4.0.62 on Emacs 21.3.50 / Mule 5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:19814 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19814 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 * 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."