aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1994-04-12 04:07:18 +0000
committerKarl Heuer1994-04-12 04:07:18 +0000
commit78328f33338c387b0714d900a2f47c356e10cf2f (patch)
treea3a644fe7c16e2e80fe8e014454de59597862bfe
parentcd9e76eae2ca88c416ab3af97651e938d4c6f54a (diff)
downloademacs-78328f33338c387b0714d900a2f47c356e10cf2f.tar.gz
emacs-78328f33338c387b0714d900a2f47c356e10cf2f.zip
(gud-filter): Let comint-output-filter do the hard work.
-rw-r--r--lisp/gud.el45
1 files changed, 16 insertions, 29 deletions
diff --git a/lisp/gud.el b/lisp/gud.el
index b7e97d40173..debe6d2ca48 100644
--- a/lisp/gud.el
+++ b/lisp/gud.el
@@ -926,40 +926,27 @@ comint mode, which see."
926;; into the buffer. The hard work is done by the method that is 926;; into the buffer. The hard work is done by the method that is
927;; the value of gud-marker-filter. 927;; the value of gud-marker-filter.
928 928
929;; Rather than duplicating all the work of comint-output-filter, perhaps
930;; gud-filter should be implemented by adding appropriate hooks to
931;; comint-output-filter. Would somebody like to volunteer to do that?
932(defun gud-filter (proc string) 929(defun gud-filter (proc string)
933 ;; Here's where the actual buffer insertion is done 930 ;; Here's where the actual buffer insertion is done
934 (let ((inhibit-quit t)) 931 (let ((inhibit-quit t))
935 (save-excursion 932 (save-excursion
936 (set-buffer (process-buffer proc)) 933 (set-buffer (process-buffer proc))
937 (let (moving output-after-point) 934 ;; If we have been so requested, delete the debugger prompt.
938 (save-excursion 935 (if (marker-buffer gud-delete-prompt-marker)
939 (goto-char (process-mark proc)) 936 (progn
940 ;; If we have been so requested, delete the debugger prompt. 937 (delete-region (process-mark proc) gud-delete-prompt-marker)
941 (if (marker-buffer gud-delete-prompt-marker) 938 (set-marker gud-delete-prompt-marker nil)))
942 (progn 939 ;; Let the comint filter do the actual insertion.
943 (delete-region (point) gud-delete-prompt-marker) 940 ;; That lets us inherit various comint features.
944 (set-marker gud-delete-prompt-marker nil))) 941 (comint-output-filter proc (gud-marker-filter string))
945 (setq string (gud-marker-filter string)) 942 ;; Check for a filename-and-line number.
946 (insert-before-markers string) 943 ;; Don't display the specified file
947 (and comint-last-input-end 944 ;; unless (1) point is at or after the position where output appears
948 (marker-buffer comint-last-input-end) 945 ;; and (2) this buffer is on the screen.
949 (= (point) comint-last-input-end) 946 (if (and gud-last-frame
950 (set-marker comint-last-input-end 947 (>= (point) (process-mark proc))
951 (- comint-last-input-end (length string)))) 948 (get-buffer-window (current-buffer)))
952 (setq moving (= (point) (process-mark proc))) 949 (gud-display-frame)))))
953 (setq output-after-point (< (point) (process-mark proc)))
954 ;; Check for a filename-and-line number.
955 ;; Don't display the specified file
956 ;; unless (1) point is at or after the position where output appears
957 ;; and (2) this buffer is on the screen.
958 (if (and gud-last-frame
959 (not output-after-point)
960 (get-buffer-window (current-buffer)))
961 (gud-display-frame)))
962 (if moving (goto-char (process-mark proc)))))))
963 950
964(defun gud-sentinel (proc msg) 951(defun gud-sentinel (proc msg)
965 (cond ((null (buffer-name (process-buffer proc))) 952 (cond ((null (buffer-name (process-buffer proc)))