looks like out comint waiting function needs some work...

This commit is contained in:
Eric Schulte 2009-06-11 12:35:48 -07:00
parent 0573fc4d9c
commit f5481ab666

View file

@ -61,13 +61,19 @@ body inside the protection of `save-window-excursion' and
(remove-hook 'comint-output-filter-functions ',my-filter)) (remove-hook 'comint-output-filter-functions ',my-filter))
string-buffer))) string-buffer)))
(defun org-babel-comint-wait-for-output (buffer) (defun org-babel-comint-command-to-output (buffer cmd)
"Wait until output arrives" "Pass CMD to BUFFER using `org-babel-comint-input-command', and
(org-babel-comint-in-buffer buffer then return the a list of the output(s) generated by CMD."
(while (progn (let ((raw (org-babel-comint-with-output
(goto-char comint-last-input-end) (org-babel-comint-input-command buffer cmd))))
(not (re-search-forward comint-prompt-regexp nil t))) (mapcar #'org-babel-chomp
(accept-process-output (get-buffer-process buffer))))) ;; split the output along prompts
(split-string
;; remove CMD if it is at the front of the output
(if (string= cmd (substring raw 0 (length cmd)))
(substring raw (length cmd))
raw)
comint-prompt-regexp))))
(defun org-babel-comint-input-command (buffer cmd) (defun org-babel-comint-input-command (buffer cmd)
"Pass CMD to BUFFER The input will not be echoed." "Pass CMD to BUFFER The input will not be echoed."
@ -77,12 +83,13 @@ body inside the protection of `save-window-excursion' and
(comint-send-input) (comint-send-input)
(org-babel-comint-wait-for-output buffer))) (org-babel-comint-wait-for-output buffer)))
(defun org-babel-comint-command-to-output (buffer cmd) (defun org-babel-comint-wait-for-output (buffer)
"Pass CMD to BUFFER using `org-babel-comint-input-command', and "Wait until output arrives"
then return the result as a string using (org-babel-comint-in-buffer buffer
`org-babel-comint-last-value'." (while (progn
(org-babel-comint-input-command buffer cmd) (goto-char comint-last-input-end)
(org-babel-comint-last-value buffer)) (not (re-search-forward comint-prompt-regexp nil t)))
(accept-process-output (get-buffer-process buffer)))))
(defun org-babel-comint-command-to-last (buffer cmd) (defun org-babel-comint-command-to-last (buffer cmd)
"Pass CMD to BUFFER using `org-babel-comint-input-command', and "Pass CMD to BUFFER using `org-babel-comint-input-command', and