From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Nick Roberts Newsgroups: gmane.emacs.devel Subject: Two changes to tooltip.el (proposal) Date: Tue, 19 Nov 2002 19:24:55 +0000 Sender: emacs-devel-admin@gnu.org Message-ID: <15834.36871.423062.687204@nick.uklinux.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1037734363 32103 80.91.224.249 (19 Nov 2002 19:32:43 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 19 Nov 2002 19:32:43 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18EE6x-0008LO-00 for ; Tue, 19 Nov 2002 20:32:39 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18EE9n-00048M-00 for ; Tue, 19 Nov 2002 20:35:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18EE2p-0005LS-00; Tue, 19 Nov 2002 14:28:23 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18EE1c-00039r-00 for emacs-devel@gnu.org; Tue, 19 Nov 2002 14:27:08 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18EE1X-00033A-00 for emacs-devel@gnu.org; Tue, 19 Nov 2002 14:27:06 -0500 Original-Received: from bts-0321.dialup.zetnet.co.uk ([194.247.49.65] helo=nick.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.10) id 18EE1W-0002v2-00 for emacs-devel@gnu.org; Tue, 19 Nov 2002 14:27:02 -0500 Original-Received: by nick.uklinux.net (Postfix, from userid 501) id A8C0376038; Tue, 19 Nov 2002 19:24:55 +0000 (GMT) Original-To: emacs-devel@gnu.org X-Mailer: VM 6.97 under Emacs 21.1.1 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:9552 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:9552 These are changes that will work with gud.el (and not currently with gdb-ui.el) 1) tooltip.el uses the function `tooltip-gud-print-command' called from `tooltip-identifier-from-point' to parse a variable name to display a variable value as a tooltip in GUD. According to the documentation the identifier is extracted using the current syntax table. It doesn't seem to be very good and only really seems to work for simple variable names. But there is already a function in gud.el, called `gud-find-c-expr', that does a very good job for this. I suggest using this so that `tooltip-identifier-from-point' would become : (defun tooltip-identifier-from-point (point) "Extract the identifier at POINT, if any." (save-excursion (goto-char point) (gud-find-c-expr))) The current `tooltip-identifier-from-point' returns nil if no identifier exists at point whereas `gud-find-c-expr' returns the empty string (""). This doesn't seem to cause a problem though. 2) A good way to step through a program in gdb is to n and then simply keep pressing to repeat the last command (`next' in this case). The function `tooltip-gud-print-command' uses the gdb command `print' to display a variable value as a tooltip in GUD. This puts `print' into the command history. If you stop to look at a variable as a tooltip and then go back to the GUD buffer and press , the command `print' is executed rather than `next'. If, however, you replace `print' in `tooltip-gud-print-command' with `server print' it doesn't go into the command history and things behave as you would expect. So I suggest the following : (defun tooltip-gud-print-command (expr) "Return a suitable command to print the expression EXPR. If TOOLTIP-GUD-DEREFERENCE is t, also prepend a `*' to EXPR." (when tooltip-gud-dereference (setq expr (concat "*" expr))) (case tooltip-gud-debugger (gdb (concat "server print " expr)) (dbx (concat "print " expr)) (xdb (concat "p " expr)) (sdb (concat expr "/")) (perldb expr))) To the emacs maintainers : Shall I install these changes ? Nick