comparison lisp/ilisp/bridge.el @ 4:b82b59fe008d r19-15b3

Import from CVS: tag r19-15b3
author cvs
date Mon, 13 Aug 2007 08:46:56 +0200
parents 376386a54a3c
children
comparison
equal deleted inserted replaced
3:30df88044ec6 4:b82b59fe008d
1 ;;; -*-Emacs-Lisp-*- 1 ;;; -*-Emacs-Lisp-*-
2 ;;;%Header 2 ;;;%Header
3 ;;; Bridge process filter, V1.0 3 ;;; Bridge process filter, V1.0
4 ;;; Copyright (C) 1991 Chris McConnell, ccm@cs.cmu.edu 4 ;;; Copyright (C) 1991 Chris McConnell, ccm@cs.cmu.edu
5 ;;; 5 ;;;
6 ;;; Send mail to ilisp@lehman.com if you have problems. 6 ;;; Send mail to ilisp@naggum.no if you have problems.
7 ;;; 7 ;;;
8 ;;; Send mail to ilisp-request@lehman.com if you want to be on the 8 ;;; Send mail to ilisp-request@naggum.no if you want to be on the
9 ;;; ilisp mailing list. 9 ;;; ilisp mailing list.
10 10
11 ;;; This file is part of GNU Emacs. 11 ;;; This file is part of GNU Emacs.
12 12
13 ;;; GNU Emacs is distributed in the hope that it will be useful, 13 ;;; GNU Emacs is distributed in the hope that it will be useful,
147 (select-window window) 147 (select-window window)
148 (recenter '(center)) 148 (recenter '(center))
149 (select-window original))))))))) 149 (select-window original)))))))))
150 150
151 ;;; 151 ;;;
152 (defun bridge-send-string (process string) 152 ;(defun bridge-send-string (process string)
153 "Send PROCESS the contents of STRING as input. 153 ; "Send PROCESS the contents of STRING as input.
154 This is equivalent to process-send-string, except that long input strings 154 ;This is equivalent to process-send-string, except that long input strings
155 are broken up into chunks of size comint-input-chunk-size. Processes 155 ;are broken up into chunks of size comint-input-chunk-size. Processes
156 are given a chance to output between chunks. This can help prevent processes 156 ;are given a chance to output between chunks. This can help prevent processes
157 from hanging when you send them long inputs on some OS's." 157 ;from hanging when you send them long inputs on some OS's."
158 (let* ((len (length string)) 158 ; (let* ((len (length string))
159 (i (min len bridge-chunk-size))) 159 ; (i (min len bridge-chunk-size)))
160 (process-send-string process (substring string 0 i)) 160 ; (process-send-string process (substring string 0 i))
161 (while (< i len) 161 ; (while (< i len)
162 (let ((next-i (+ i bridge-chunk-size))) 162 ; (let ((next-i (+ i bridge-chunk-size)))
163 (accept-process-output) 163 ; (accept-process-output)
164 (process-send-string process (substring string i (min len next-i))) 164 ; (process-send-string process (substring string i (min len next-i)))
165 (setq i next-i))))) 165 ; (setq i next-i)))))
166 166
167 ;;; 167 ;;;
168 (defun bridge-call-handler (handler proc string) 168 (defun bridge-call-handler (handler proc string)
169 "Funcall HANDLER on PROC, STRING carefully. Error is caught if happens, 169 "Funcall HANDLER on PROC, STRING carefully. Error is caught if happens,
170 and user is signaled. State is put in bridge-last-failure. Returns t if 170 and user is signaled. State is put in bridge-last-failure. Returns t if
216 (if to 216 (if to
217 (bridge-insert input) 217 (bridge-insert input)
218 (goto-char (point-max)) 218 (goto-char (point-max))
219 (insert input))) 219 (insert input)))
220 (set-buffer buffer))) 220 (set-buffer buffer)))
221 (if to (bridge-send-string to input))) 221 (if to
222 ;; (bridge-send-string to input)
223 (process-send-string to input)
224 ))
222 (error "%s is not a buffer" buffer-name))))) 225 (error "%s is not a buffer" buffer-name)))))
223 226
224 ;;;%Filter 227 ;;;%Filter
225 (defun bridge-filter (process output) 228 (defun bridge-filter (process output)
226 "Given PROCESS and some OUTPUT, check for the presence of 229 "Given PROCESS and some OUTPUT, check for the presence of