changeset 1274:4d867d1bedda

* gud.el (gud-filter-insert): Previous changes misunderstood the arrangement of unwind-protect and the save-excursion; restored that structure.
author Jim Blandy <jimb@redhat.com>
date Wed, 30 Sep 1992 08:29:25 +0000
parents bbf7e139412b
children 68f025a5fdaa
files lisp/gud.el
diffstat 1 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gud.el	Wed Sep 30 01:45:47 1992 +0000
+++ b/lisp/gud.el	Wed Sep 30 08:29:25 1992 +0000
@@ -439,22 +439,25 @@
   ;; Here's where the actual buffer insertion is done
   (save-excursion
     (set-buffer (process-buffer proc))
-    (let ((output-after-point (< (point) (process-mark proc))))
-      (goto-char (process-mark proc))
-      ;; If we have been so requested, delete the debugger prompt.
-      (if (marker-buffer gud-delete-prompt-marker)
-	  (progn
-	    (delete-region (point) gud-delete-prompt-marker)
-	    (set-marker gud-delete-prompt-marker nil)))
-      (insert-before-markers string)
-      ;; Check for a filename-and-line number.
-      ;; Don't display the specified file
-      ;; unless (1) point is at or after the position where output appears
-      ;; and (2) this buffer is on the screen.
-      (if (and gud-last-frame
-	       (not output-after-point)
-	       (get-buffer-window (current-buffer)))
-	  (gud-display-frame)))))
+    (let ((moving (= (point) (process-mark proc)))
+	  (output-after-point (< (point) (process-mark proc))))
+      (save-excursion
+	(goto-char (process-mark proc))
+	;; If we have been so requested, delete the debugger prompt.
+	(if (marker-buffer gud-delete-prompt-marker)
+	    (progn
+	      (delete-region (point) gud-delete-prompt-marker)
+	      (set-marker gud-delete-prompt-marker nil)))
+	(insert-before-markers string)
+	;; Check for a filename-and-line number.
+	;; Don't display the specified file
+	;; unless (1) point is at or after the position where output appears
+	;; and (2) this buffer is on the screen.
+	(if (and gud-last-frame
+		 (not output-after-point)
+		 (get-buffer-window (current-buffer)))
+	    (gud-display-frame)))
+      (if moving (goto-char (process-mark proc))))))
 
 (defun gud-sentinel (proc msg)
   (cond ((null (buffer-name (process-buffer proc)))