changeset 70503:f403849ca1a6

(gdb-var-create-handler): Move speedbar call to... (gud-watch): ...here so speedbar is raised for already watched expressions. (gdb-speedbar-refresh): Delete function. (gdb-speedbar-update, gdb-speedbar-timer-fn): New functions. Use speedbar-timer-fn instead of speedbar-refresh (reverting earlier change). (gdb-var-evaluate-expression-handler) (gdb-var-list-children-handler-1, gdb-var-update-handler-1): Use it.
author Nick Roberts <nickrob@snap.net.nz>
date Sun, 07 May 2006 12:08:23 +0000
parents 974c45d6c4eb
children f30d66ed3e9a
files lisp/progmodes/gdb-ui.el
diffstat 1 files changed, 19 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el	Sun May 07 12:07:38 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Sun May 07 12:08:23 2006 +0000
@@ -694,6 +694,7 @@
 		     (if (and transient-mark-mode mark-active)
 			 (buffer-substring (region-beginning) (region-end))
 		       (tooltip-identifier-from-point (point))))))
+	      (speedbar 1)
 	      (catch 'already-watched
 		(dolist (var gdb-var-list)
 		  (unless (string-match "\\." (car var))
@@ -725,7 +726,6 @@
 		  (match-string 3)
 		  nil nil gdb-frame-address)))
 	(push var gdb-var-list)
-	(speedbar 1)
 	(unless (string-equal
 		 speedbar-initial-expansion-list-name "GUD")
 	  (speedbar-change-initial-expansion-list "GUD"))
@@ -741,13 +741,26 @@
 	(message-box "Watching expressions requires gdb 6.0 onwards")
       (message-box "No symbol \"%s\" in current context." expr))))
 
+(defun gdb-speedbar-update ()
+  (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
+    ;; Dummy command to update speedbar even when idle.
+    (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn))
+    ;; Keep gdb-pending-triggers non-nil till end.
+    (push 'gdb-speedbar-timer gdb-pending-triggers)))
+
+(defun gdb-speedbar-timer-fn ()
+  (setq gdb-pending-triggers
+	(delq 'gdb-speedbar-timer gdb-pending-triggers))
+  (speedbar-timer-fn))
+
 (defun gdb-var-evaluate-expression-handler (varnum changed)
   (goto-char (point-min))
   (re-search-forward ".*value=\\(\".*\"\\)" nil t)
   (let ((var (assoc varnum gdb-var-list)))
     (when var
       (if changed (setcar (nthcdr 5 var) 'changed))
-      (setcar (nthcdr 4 var) (read (match-string 1))))))
+      (setcar (nthcdr 4 var) (read (match-string 1)))))
+  (gdb-speedbar-update))
 
 (defun gdb-var-list-children (varnum)
   (gdb-enqueue-input
@@ -811,21 +824,7 @@
 		  varnum "\"\n")
 	  `(lambda () (gdb-var-evaluate-expression-handler ,varnum t)))))))
   (setq gdb-pending-triggers
-	(delq 'gdb-var-update gdb-pending-triggers))
-  (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
-    ;; Dummy command to update speedbar at right time.
-    (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-refresh))
-    ;; Keep gdb-pending-triggers non-nil till end.
-    (push 'gdb-speedbar-refresh gdb-pending-triggers)))
-
-(defun gdb-speedbar-refresh ()
-  (setq gdb-pending-triggers
-	(delq 'gdb-speedbar-refresh gdb-pending-triggers))
-  (with-current-buffer gud-comint-buffer
-    (let ((speedbar-verbosity-level 0)
-	  (speedbar-shown-directories nil))
-      (save-excursion
-	(speedbar-refresh)))))
+	(delq 'gdb-var-update gdb-pending-triggers)))
 
 (defun gdb-var-delete ()
   "Delete watch expression at point from the speedbar."
@@ -2804,8 +2803,6 @@
   (setq overlay-arrow-variable-list
 	(delq 'gdb-overlay-arrow-position overlay-arrow-variable-list))
   (setq fringe-indicator-alist '((overlay-arrow . right-triangle)))
-  (if (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
-      (speedbar-refresh))
   (setq gud-running nil)
   (setq gdb-active-process nil)
   (setq gdb-var-list nil)
@@ -3233,7 +3230,8 @@
 		      (throw 'child-already-watched nil))
 		  (push varchild var-list))))
 	  (push var var-list)))
-      (setq gdb-var-list (nreverse var-list)))))
+      (setq gdb-var-list (nreverse var-list))))
+  (gdb-speedbar-update))
 
 ; Uses "-var-update --all-values".  Needs GDB 6.4 onwards.
 (defun gdb-var-update-1 ()
@@ -3266,11 +3264,7 @@
 		  (read (match-string 2)))))))
   (setq gdb-pending-triggers
    (delq 'gdb-var-update gdb-pending-triggers))
-  (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
-    ;; dummy command to update speedbar at right time
-    (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-refresh))
-    ;; keep gdb-pending-triggers non-nil till end
-    (push 'gdb-speedbar-refresh gdb-pending-triggers)))
+  (gdb-speedbar-update))
 
 ;; Registers buffer.
 ;;