[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Two changes to tooltip.el (proposal)

From: Nick Roberts
Subject: Two changes to tooltip.el (proposal)
Date: Tue, 19 Nov 2002 19:24:55 +0000

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 
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."
    (goto-char point)

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<RET> and then simply
keep pressing <RET> 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 <RET>, 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 ?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]