aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-09-06 17:07:53 +0000
committerRichard M. Stallman1995-09-06 17:07:53 +0000
commit117364886e891fd9fddc8273a475dad833bc8f69 (patch)
tree3f2c98f8dc26f9d03994dc67e9e9467c2d39e703
parent469dd2ef08cb3c24ec9cd35fe6df7803fca5b8d6 (diff)
downloademacs-117364886e891fd9fddc8273a475dad833bc8f69.tar.gz
emacs-117364886e891fd9fddc8273a475dad833bc8f69.zip
(gud-filter): Save up text that arrives while processing previous text.
-rw-r--r--lisp/gud.el64
1 files changed, 44 insertions, 20 deletions
diff --git a/lisp/gud.el b/lisp/gud.el
index 87917045838..787d7e74bc2 100644
--- a/lisp/gud.el
+++ b/lisp/gud.el
@@ -1175,6 +1175,13 @@ comint mode, which see."
1175 (cond ((eq major-mode 'gud-mode) 1175 (cond ((eq major-mode 'gud-mode)
1176 (setq gud-comint-buffer (current-buffer))))) 1176 (setq gud-comint-buffer (current-buffer)))))
1177 1177
1178(defvar gud-filter-defer-flag nil
1179 "Non-nil means don't process anything from the debugger right now.
1180It is saved for when this flag is not set.")
1181
1182(defvar gud-filter-pending-text nil
1183 "Non-nil means this is text that has been saved for later in `gud-filter'.")
1184
1178;; These functions are responsible for inserting output from your debugger 1185;; These functions are responsible for inserting output from your debugger
1179;; into the buffer. The hard work is done by the method that is 1186;; into the buffer. The hard work is done by the method that is
1180;; the value of gud-marker-filter. 1187;; the value of gud-marker-filter.
@@ -1183,26 +1190,43 @@ comint mode, which see."
1183 ;; Here's where the actual buffer insertion is done 1190 ;; Here's where the actual buffer insertion is done
1184 (let (output) 1191 (let (output)
1185 (if (buffer-name (process-buffer proc)) 1192 (if (buffer-name (process-buffer proc))
1186 (save-excursion 1193 (if gud-filter-defer-flag
1187 (set-buffer (process-buffer proc)) 1194 ;; If we can't process any text now,
1188 ;; If we have been so requested, delete the debugger prompt. 1195 ;; save it for later.
1189 (if (marker-buffer gud-delete-prompt-marker) 1196 (setq gud-filter-pending-text
1190 (progn 1197 (concat (or gud-filter-pending-text "") string))
1191 (delete-region (process-mark proc) gud-delete-prompt-marker) 1198 (save-excursion
1192 (set-marker gud-delete-prompt-marker nil))) 1199 ;; If we have to ask a question during the processing,
1193 ;; Save the process output, checking for source file markers. 1200 ;; defer any additional text that comes from the debugger
1194 (setq output (gud-marker-filter string)) 1201 ;; during that time.
1195 ;; Check for a filename-and-line number. 1202 (let ((gud-filter-defer-flag t))
1196 ;; Don't display the specified file 1203 ;; Process now any text we previously saved up.
1197 ;; unless (1) point is at or after the position where output appears 1204 (if gud-filter-pending-text
1198 ;; and (2) this buffer is on the screen. 1205 (setq string (concat gud-filter-pending-text string)
1199 (if (and gud-last-frame 1206 gud-filter-pending-text nil))
1200 (>= (point) (process-mark proc)) 1207 (set-buffer (process-buffer proc))
1201 (get-buffer-window (current-buffer))) 1208 ;; If we have been so requested, delete the debugger prompt.
1202 (gud-display-frame)) 1209 (if (marker-buffer gud-delete-prompt-marker)
1203 ;; Let the comint filter do the actual insertion. 1210 (progn
1204 ;; That lets us inherit various comint features. 1211 (delete-region (process-mark proc) gud-delete-prompt-marker)
1205 (comint-output-filter proc output))))) 1212 (set-marker gud-delete-prompt-marker nil)))
1213 ;; Save the process output, checking for source file markers.
1214 (setq output (gud-marker-filter string))
1215 ;; Check for a filename-and-line number.
1216 ;; Don't display the specified file
1217 ;; unless (1) point is at or after the position where output appears
1218 ;; and (2) this buffer is on the screen.
1219 (if (and gud-last-frame
1220 (>= (point) (process-mark proc))
1221 (get-buffer-window (current-buffer)))
1222 (gud-display-frame))
1223 ;; Let the comint filter do the actual insertion.
1224 ;; That lets us inherit various comint features.
1225 (comint-output-filter proc output))
1226 ;; If we deferred text that arrived during this processing,
1227 ;; handle it now.
1228 (if gud-filter-pending-text
1229 (gud-filter proc "")))))))
1206 1230
1207(defun gud-sentinel (proc msg) 1231(defun gud-sentinel (proc msg)
1208 (cond ((null (buffer-name (process-buffer proc))) 1232 (cond ((null (buffer-name (process-buffer proc)))