changeset 80510:f3ac5401fa8e

(gdb-init-buffer): New function. (gdb-set-gud-minor-mode-existing-buffers) (gdb-info-breakpoints-custom, gdb-get-location) (gdb-set-gud-minor-mode-existing-buffers-1): Use it. Previously gdb-create-define-alist wasn't always run and added to after-save-hook.
author Nick Roberts <nickrob@snap.net.nz>
date Sat, 12 Apr 2008 13:13:32 +0000
parents 4bf438f2be05
children e85df11c51e4
files lisp/progmodes/gdb-ui.el
diffstat 1 files changed, 14 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el	Sat Apr 12 13:11:35 2008 +0000
+++ b/lisp/progmodes/gdb-ui.el	Sat Apr 12 13:13:32 2008 +0000
@@ -483,6 +483,15 @@
 
 (defconst gdb-source-file-regexp "\\(.+?\\), \\|\\([^, \n].*$\\)")
 
+(defun gdb-init-buffer ()
+  (set (make-local-variable 'gud-minor-mode)
+       (buffer-local-value 'gud-minor-mode gud-comint-buffer))
+  (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
+  (when gud-tooltip-mode
+    (make-local-variable 'gdb-define-alist)
+    (gdb-create-define-alist)
+    (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))
+
 (defun gdb-set-gud-minor-mode-existing-buffers ()
   "Create list of source files for current GDB session."
   (goto-char (point-min))
@@ -495,12 +504,7 @@
 	(when (and buffer-file-name
 		   (member (file-name-nondirectory buffer-file-name)
 			   gdb-source-file-list))
-	  (set (make-local-variable 'gud-minor-mode) 'gdba)
-	  (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
-	  (when gud-tooltip-mode
-	    (make-local-variable 'gdb-define-alist)
-	    (gdb-create-define-alist)
-	    (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))))
+	  (gdb-init-buffer)))))
   (gdb-force-mode-line-update
    (propertize "ready" 'face font-lock-variable-name-face)))
 
@@ -1940,10 +1944,7 @@
 				   (not (string-equal file "File not found")))
 			      (with-current-buffer
 				  (find-file-noselect file 'nowarn)
-				(set (make-local-variable 'gud-minor-mode)
-				     'gdba)
-				(set (make-local-variable 'tool-bar-map)
-				     gud-tool-bar-map)
+				(gdb-init-buffer)
 				;; Only want one breakpoint icon at each
 				;; location.
 				(save-excursion
@@ -3142,9 +3143,7 @@
       (throw 'file-not-found nil))
     (with-current-buffer
 	(find-file-noselect (match-string 0))
-      (save-current-buffer
-	(set (make-local-variable 'gud-minor-mode) 'gdba)
-	(set (make-local-variable 'tool-bar-map) gud-tool-bar-map))
+      (gdb-init-buffer)
       ;; only want one breakpoint icon at each location
       (save-excursion
 	(goto-line (string-to-number line))
@@ -3166,9 +3165,7 @@
 		    buffer-file-name)
 		  gdb-source-file-list)
 	  (with-current-buffer (find-buffer-visiting buffer-file-name)
-	    (set (make-local-variable 'gud-minor-mode)
-		 (buffer-local-value 'gud-minor-mode gud-comint-buffer))
-	    (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)))))
+	    (gdb-init-buffer)))))
 
 ;;from put-image
 (defun gdb-put-string (putstring pos &optional dprop &rest sprops)
@@ -3493,13 +3490,7 @@
   (dolist (buffer (buffer-list))
     (with-current-buffer buffer
       (when (member buffer-file-name gdb-source-file-list)
-	(set (make-local-variable 'gud-minor-mode)
-	     (buffer-local-value 'gud-minor-mode gud-comint-buffer))
-	(set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
-	(when gud-tooltip-mode
-	  (make-local-variable 'gdb-define-alist)
-	  (gdb-create-define-alist)
-	  (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))
+	(gdb-init-buffer))))
   (gdb-force-mode-line-update
    (propertize "ready" 'face font-lock-variable-name-face)))