changeset 54132:492d1a28eca8

(gud-watch): Load tooltip, if necessary. (gdb-var-create-handler): Force speedbar-update-flag to be non-nil. (gdb-var-delete): Make interactive (really). (gdb-edit-value): Make non-interactive.
author Nick Roberts <nickrob@snap.net.nz>
date Mon, 23 Feb 2004 00:44:04 +0000
parents 6534ec3bbe32
children c3fa09d47632
files lisp/gdb-ui.el
diffstat 1 files changed, 20 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gdb-ui.el	Mon Feb 23 00:43:09 2004 +0000
+++ b/lisp/gdb-ui.el	Mon Feb 23 00:44:04 2004 +0000
@@ -188,6 +188,7 @@
 (defun gud-watch ()
   "Watch expression at point."
   (interactive)
+  (require 'tooltip)
   (let ((expr (tooltip-identifier-from-point (point))))
     (if (and (string-equal gdb-current-language "c")
 	     gdb-use-colon-colon-notation)
@@ -214,6 +215,7 @@
 			 (match-string 3)
 			 nil nil)))
 	  (push var gdb-var-list)
+	  (setq speedbar-update-flag t)
 	  (speedbar 1)
 	  (if (equal (nth 2 var) "0")
 	      (gdb-enqueue-input
@@ -304,26 +306,28 @@
   (gdb-set-pending-triggers
    (delq 'gdb-var-update (gdb-get-pending-triggers))))
 
-(defun gdb-var-delete (text token indent)
-  "Delete watched expression."
+(defun gdb-var-delete ()
+  "Delete watched expression from the speedbar."
   (interactive)
-  (when (eq indent 0)
-    (string-match "\\(\\S-+\\)" text)
-    (let* ((expr (match-string 1 text))
-	   (var (assoc expr gdb-var-list))
-	   (varnum (cadr var)))
-      (gdb-enqueue-input
-       (list (concat "server interpreter mi \"-var-delete " varnum "\"\n")
-	     'ignore))
-      (setq gdb-var-list (delq var gdb-var-list))
-      (dolist (varchild gdb-var-list)
-	(if (string-match (concat (nth 1 var) "\\.") (nth 1 varchild))
-	    (setq gdb-var-list (delq varchild gdb-var-list)))))
-    (setq gdb-var-changed t)))
+  (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
+      (let ((text (speedbar-line-text)))
+	(string-match "\\(\\S-+\\)" text)
+	(let* ((expr (match-string 1 text))
+	       (var (assoc expr gdb-var-list))
+	       (varnum (cadr var)))
+	  (unless (string-match "\\." varnum)
+	    (gdb-enqueue-input
+	     (list (concat "server interpreter mi \"-var-delete "
+			   varnum "\"\n")
+		   'ignore))
+	    (setq gdb-var-list (delq var gdb-var-list))
+	    (dolist (varchild gdb-var-list)
+	      (if (string-match (concat (nth 1 var) "\\.") (nth 1 varchild))
+		  (setq gdb-var-list (delq varchild gdb-var-list))))
+	    (setq gdb-var-changed t))))))
 
 (defun gdb-edit-value (text token indent)
   "Assign a value to a variable displayed in the speedbar"
-  (interactive)
   (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
 	 (varnum (cadr var)) (value))
     (setq value (read-string "New value: "))