changeset 67890:a6271fd07ee3

(gud-tooltip-dereference): Rename from toggle-gud-tooltip-dereference. (gud-tooltip-print-command): Move concatenation of "*" to expr to... (gud-tooltip-tips): ...here when dereferencing.
author Nick Roberts <nickrob@snap.net.nz>
date Thu, 29 Dec 2005 02:03:20 +0000
parents 7ee3fee734b9
children c6d86f53dcf3
files lisp/progmodes/gud.el
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gud.el	Thu Dec 29 02:01:31 2005 +0000
+++ b/lisp/progmodes/gud.el	Thu Dec 29 02:03:20 2005 +0000
@@ -3343,16 +3343,19 @@
   "The mouse movement event that led to a tooltip display.
 This event can be examined by forms in GUD-TOOLTIP-DISPLAY.")
 
-(defun toggle-gud-tooltip-dereference ()
-  "Toggle whether tooltips should show `* expr' or `expr'."
-  (interactive)
-  (setq gud-tooltip-dereference (not gud-tooltip-dereference))
-  (when (interactive-p)
-    (message "Dereferencing is now %s."
-	     (if gud-tooltip-dereference "on" "off"))))
+(defun gud-tooltip-dereference ()
+  "Toggle whether tooltips should show `* expr' or `expr'.
+With arg, dereference expr iff arg is positive."
+ (interactive "P")
+  (setq gud-tooltip-dereference
+	(if (null arg)
+	    (not gud-tooltip-dereference)
+	  (> (prefix-numeric-value arg) 0)))
+  (message "Dereferencing is now %s."
+	   (if gud-tooltip-dereference "on" "off")))
 
 (define-obsolete-function-alias 'tooltip-gud-toggle-dereference
-                                'toggle-gud-tooltip-dereference "22.1")
+                                'gud-tooltip-dereference "22.1")
 
 ; This will only display data that comes in one chunk.
 ; Larger arrays (say 400 elements) are displayed in
@@ -3367,10 +3370,7 @@
 		(or gud-tooltip-echo-area tooltip-use-echo-area)))
 
 (defun gud-tooltip-print-command (expr)
-  "Return a suitable command to print the expression EXPR.
-If GUD-TOOLTIP-DEREFERENCE is t, also prepend a `*' to EXPR."
-  (when gud-tooltip-dereference
-    (setq expr (concat "*" expr)))
+  "Return a suitable command to print the expression EXPR."
   (case gud-minor-mode
 	(gdba (concat "server print " expr))
 	((dbx gdbmi) (concat "print " expr))
@@ -3412,6 +3412,8 @@
 		       (cdr define-elt)
 		       (or gud-tooltip-echo-area tooltip-use-echo-area))
 		      expr))))
+	    (when gud-tooltip-dereference
+	      (setq expr (concat "*" expr)))
 	    (let ((cmd (gud-tooltip-print-command expr)))
 	      (when (and gud-tooltip-mode (eq gud-minor-mode 'gdb))
 		(gud-tooltip-mode -1)