]> git.eshelyaron.com Git - emacs.git/commitdiff
* gud.el (gud-gdb-marker-filter): Preserve the match data across
authorJim Blandy <jimb@redhat.com>
Fri, 30 Jul 1993 22:43:39 +0000 (22:43 +0000)
committerJim Blandy <jimb@redhat.com>
Fri, 30 Jul 1993 22:43:39 +0000 (22:43 +0000)
the filter's execution.

* gud.el (gud-gdb-marker-filter): If we received some text after
the position marker, append it to any text before the marker,
instead of throwing away the text before the marker.

lisp/gud.el

index 3b89c2406377c1f1872ed38b717d1e6727389450..4fa2a7f31cffddfb1feb7f8080e88fc1c2c7941a 100644 (file)
@@ -165,48 +165,49 @@ we're in the GUD buffer)."
 (defvar gud-gdb-marker-acc "")
 
 (defun gud-gdb-marker-filter (string)
-  (setq gud-gdb-marker-acc (concat gud-gdb-marker-acc string))
-  (let ((output ""))
-
-    ;; Process all the complete markers in this chunk.
-    (while (string-match "^\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
-                        gud-gdb-marker-acc)
-      (setq
-
-       ;; Extract the frame position from the marker.
-       gud-last-frame
-       (cons (substring gud-gdb-marker-acc (match-beginning 1) (match-end 1))
-            (string-to-int (substring gud-gdb-marker-acc
-                                      (match-beginning 2)
-                                      (match-end 2))))
-
-       ;; Append any text before the marker to the output we're going
-       ;; to return - we don't include the marker in this text.
-       output (concat output
-                     (substring gud-gdb-marker-acc 0 (match-beginning 0)))
-
-       ;; Set the accumulator to the remaining text.
-       gud-gdb-marker-acc (substring gud-gdb-marker-acc (match-end 0))))
-
-    ;; Does the remaining text look like it might end with the
-    ;; beginning of another marker?  If it does, then keep it in
-    ;; gud-gdb-marker-acc until we receive the rest of it.  Since we
-    ;; know the full marker regexp above failed, it's pretty simple to
-    ;; test for marker starts.
-    (if (string-match "^\032.*\\'" gud-gdb-marker-acc)
-       (progn
-         ;; Everything before the potential marker start can be output.
-         (setq output (concat output (substring gud-gdb-marker-acc
-                                                0 (match-beginning 0))))
+  (save-match-data
+    (setq gud-gdb-marker-acc (concat gud-gdb-marker-acc string))
+    (let ((output ""))
+
+      ;; Process all the complete markers in this chunk.
+      (while (string-match "^\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
+                          gud-gdb-marker-acc)
+       (setq
+
+        ;; Extract the frame position from the marker.
+        gud-last-frame
+        (cons (substring gud-gdb-marker-acc (match-beginning 1) (match-end 1))
+              (string-to-int (substring gud-gdb-marker-acc
+                                        (match-beginning 2)
+                                        (match-end 2))))
+
+        ;; Append any text before the marker to the output we're going
+        ;; to return - we don't include the marker in this text.
+        output (concat output
+                       (substring gud-gdb-marker-acc 0 (match-beginning 0)))
+
+        ;; Set the accumulator to the remaining text.
+        gud-gdb-marker-acc (substring gud-gdb-marker-acc (match-end 0))))
+
+      ;; Does the remaining text look like it might end with the
+      ;; beginning of another marker?  If it does, then keep it in
+      ;; gud-gdb-marker-acc until we receive the rest of it.  Since we
+      ;; know the full marker regexp above failed, it's pretty simple to
+      ;; test for marker starts.
+      (if (string-match "^\032.*\\'" gud-gdb-marker-acc)
+         (progn
+           ;; Everything before the potential marker start can be output.
+           (setq output (concat output (substring gud-gdb-marker-acc
+                                                  0 (match-beginning 0))))
 
-         ;; Everything after, we save, to combine with later input.
-         (setq gud-gdb-marker-acc
-               (substring gud-gdb-marker-acc (match-beginning 0))))
+           ;; Everything after, we save, to combine with later input.
+           (setq gud-gdb-marker-acc
+                 (substring gud-gdb-marker-acc (match-beginning 0))))
 
-      (setq output gud-gdb-marker-acc
-           gud-gdb-marker-acc ""))
+       (setq output (concat output gud-gdb-marker-acc)
+             gud-gdb-marker-acc ""))
 
-    output))
+      output)))
 
 (defun gud-gdb-find-file (f)
   (find-file-noselect f))