all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Two changes to tooltip.el (proposal)
@ 2002-11-19 19:24 Nick Roberts
  2002-11-20 11:46 ` Kim F. Storm
  2002-11-25 12:37 ` Richard Stallman
  0 siblings, 2 replies; 4+ messages in thread
From: Nick Roberts @ 2002-11-19 19:24 UTC (permalink / raw)


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<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 ?

Nick

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

end of thread, other threads:[~2002-11-25 12:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-19 19:24 Two changes to tooltip.el (proposal) Nick Roberts
2002-11-20 11:46 ` Kim F. Storm
2002-11-20 23:33   ` Nick Roberts
2002-11-25 12:37 ` Richard Stallman

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.