Function: js--wait-for-matching-output
js--wait-for-matching-output is a byte-compiled function defined in
js.el.gz.
Signature
(js--wait-for-matching-output PROCESS REGEXP TIMEOUT &optional START)
Documentation
Wait TIMEOUT seconds for PROCESS to output a match for REGEXP.
On timeout, return nil. On success, return t with match data
set. If START is non-nil, look for output starting from START.
Otherwise, use the current value of process-mark.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(define-error 'js-js-error "JavaScript Error") ;; '(js-error error))
(defun js--wait-for-matching-output
(process regexp timeout &optional start)
"Wait TIMEOUT seconds for PROCESS to output a match for REGEXP.
On timeout, return nil. On success, return t with match data
set. If START is non-nil, look for output starting from START.
Otherwise, use the current value of `process-mark'."
(with-current-buffer (process-buffer process)
(cl-loop with start-pos = (or start
(marker-position (process-mark process)))
with end-time = (time-add nil timeout)
for time-left = (float-time (time-subtract end-time nil))
do (goto-char (point-max))
if (looking-back regexp start-pos) return t
while (> time-left 0)
do (accept-process-output process time-left nil t)
do (goto-char (process-mark process))
finally do (signal
'js-moz-bad-rpc
(list (format "Timed out waiting for output matching %S" regexp))))))