changeset 48640:7bc8b0b65a02

(gdba): Use the default for gud-find-file. (def-gdb-variable): Remove: fold into def-gdb-var. (def-gdb-var): Use buffer-local-value and with-current-buffer.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 03 Dec 2002 21:40:47 +0000
parents 00993d9b9cb7
children da382393fb77
files lisp/gdb-ui.el
diffstat 1 files changed, 15 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gdb-ui.el	Tue Dec 03 21:11:15 2002 +0000
+++ b/lisp/gdb-ui.el	Tue Dec 03 21:40:47 2002 +0000
@@ -96,8 +96,7 @@
 
   (interactive (list (gud-query-cmdline 'gdba)))
 
-  (gdba-common-init command-line nil
-		   'gdba-marker-filter 'gud-gdb-find-file)
+  (gdba-common-init command-line nil 'gdba-marker-filter)
 
   (set (make-local-variable 'gud-minor-mode) 'gdba)
 
@@ -293,32 +292,24 @@
 ;;; DEF-GDB-VARIABLE
 ;;;
 
-(defmacro def-gdb-variable (name accessor setter &optional default doc)
-  `(progn
-     (defvar ,name ,default ,doc)
-     (if (not (memq ',name gdb-instance-variables))
-	 (push ',name gdb-instance-variables))
-     ,(and accessor
-	     `(defun ,accessor ()
-		(let ((buffer (gdb-get-instance-buffer 'gdba)))
-		  (and buffer (save-excursion
-				(set-buffer buffer)
-				,name)))))
-     ,(and setter
-	     `(defun ,setter (val)
-		(let ((buffer (gdb-get-instance-buffer 'gdba)))
-		  (and buffer (save-excursion
-				(set-buffer buffer)
-				(setq ,name val))))))))
-
 (defmacro def-gdb-var (root-symbol &optional default doc)
   (let* ((root (symbol-name root-symbol))
 	 (accessor (intern (concat "gdb-instance-" root)))
 	 (setter (intern (concat "set-gdb-instance-" root)))
-	 (var-name (intern (concat "gdb-" root))))
-    `(def-gdb-variable
-	 ,var-name ,accessor ,setter
-	 ,default ,doc)))
+	 (name (intern (concat "gdb-" root))))
+    `(progn
+       (defvar ,name ,default ,doc)
+       (if (not (memq ',name gdb-instance-variables))
+	   (push ',name gdb-instance-variables))
+       ,(and accessor
+	     `(defun ,accessor ()
+		(let ((buffer (gdb-get-instance-buffer 'gdba)))
+		  (and buffer (buffer-local-value ',name buffer)))))
+       ,(and setter
+	     `(defun ,setter (val)
+		(let ((buffer (gdb-get-instance-buffer 'gdba)))
+		  (and buffer (with-current-buffer buffer
+				(setq ,name val)))))))))
 
 (def-gdb-var buffer-type nil
   "One of the symbols bound in gdb-instance-buffer-rules")