unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nick Roberts <nick@nick.uklinux.net>
Subject: Two changes to tooltip.el (proposal)
Date: Tue, 19 Nov 2002 19:24:55 +0000	[thread overview]
Message-ID: <15834.36871.423062.687204@nick.uklinux.net> (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

             reply	other threads:[~2002-11-19 19:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-19 19:24 Nick Roberts [this message]
2002-11-20 11:46 ` Two changes to tooltip.el (proposal) Kim F. Storm
2002-11-20 23:33   ` Nick Roberts
2002-11-25 12:37 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15834.36871.423062.687204@nick.uklinux.net \
    --to=nick@nick.uklinux.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).