Mercurial > emacs
changeset 13003:4711396531e8
(gud-filter): Save up text that arrives while processing previous text.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 06 Sep 1995 17:07:53 +0000 |
parents | 237f7920c3a2 |
children | 0ed37da6f0f3 |
files | lisp/gud.el |
diffstat | 1 files changed, 44 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/gud.el Wed Sep 06 15:18:29 1995 +0000 +++ b/lisp/gud.el Wed Sep 06 17:07:53 1995 +0000 @@ -1175,6 +1175,13 @@ (cond ((eq major-mode 'gud-mode) (setq gud-comint-buffer (current-buffer))))) +(defvar gud-filter-defer-flag nil + "Non-nil means don't process anything from the debugger right now. +It is saved for when this flag is not set.") + +(defvar gud-filter-pending-text nil + "Non-nil means this is text that has been saved for later in `gud-filter'.") + ;; These functions are responsible for inserting output from your debugger ;; into the buffer. The hard work is done by the method that is ;; the value of gud-marker-filter. @@ -1183,26 +1190,43 @@ ;; Here's where the actual buffer insertion is done (let (output) (if (buffer-name (process-buffer proc)) - (save-excursion - (set-buffer (process-buffer proc)) - ;; If we have been so requested, delete the debugger prompt. - (if (marker-buffer gud-delete-prompt-marker) - (progn - (delete-region (process-mark proc) gud-delete-prompt-marker) - (set-marker gud-delete-prompt-marker nil))) - ;; Save the process output, checking for source file markers. - (setq output (gud-marker-filter 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 - (>= (point) (process-mark proc)) - (get-buffer-window (current-buffer))) - (gud-display-frame)) - ;; Let the comint filter do the actual insertion. - ;; That lets us inherit various comint features. - (comint-output-filter proc output))))) + (if gud-filter-defer-flag + ;; If we can't process any text now, + ;; save it for later. + (setq gud-filter-pending-text + (concat (or gud-filter-pending-text "") string)) + (save-excursion + ;; If we have to ask a question during the processing, + ;; defer any additional text that comes from the debugger + ;; during that time. + (let ((gud-filter-defer-flag t)) + ;; Process now any text we previously saved up. + (if gud-filter-pending-text + (setq string (concat gud-filter-pending-text string) + gud-filter-pending-text nil)) + (set-buffer (process-buffer proc)) + ;; If we have been so requested, delete the debugger prompt. + (if (marker-buffer gud-delete-prompt-marker) + (progn + (delete-region (process-mark proc) gud-delete-prompt-marker) + (set-marker gud-delete-prompt-marker nil))) + ;; Save the process output, checking for source file markers. + (setq output (gud-marker-filter 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 + (>= (point) (process-mark proc)) + (get-buffer-window (current-buffer))) + (gud-display-frame)) + ;; Let the comint filter do the actual insertion. + ;; That lets us inherit various comint features. + (comint-output-filter proc output)) + ;; If we deferred text that arrived during this processing, + ;; handle it now. + (if gud-filter-pending-text + (gud-filter proc ""))))))) (defun gud-sentinel (proc msg) (cond ((null (buffer-name (process-buffer proc)))