Function: org-babel-forth-session-execute
org-babel-forth-session-execute is a byte-compiled function defined in
ob-forth.el.gz.
Signature
(org-babel-forth-session-execute BODY PARAMS)
Source Code
;; Defined in /usr/src/emacs/lisp/org/ob-forth.el.gz
(defun org-babel-forth-session-execute (body params)
(require 'forth-mode)
(let ((proc (forth-proc))
(rx " \\(\n:\\|compiled\n\\|ok\n\\)")
(result-start))
(with-current-buffer (process-buffer (forth-proc))
(mapcar (lambda (line)
(setq result-start (progn (goto-char (process-mark proc))
(point)))
(comint-send-string proc (concat line "\n"))
;; wait for forth to say "ok"
(while (not (progn (goto-char result-start)
(re-search-forward rx nil t)))
(accept-process-output proc 0.01))
(let ((case (match-string 1)))
(cond
((string= "ok\n" case)
;; Collect intermediate output.
(buffer-substring (+ result-start 1 (length line))
(match-beginning 0)))
((string= "compiled\n" case))
;; Ignore partial compilation.
((string= "\n:" case)
;; Report errors.
(org-babel-eval-error-notify 1
(buffer-substring
(+ (match-beginning 0) 1) (point-max)))
nil))))
(split-string (org-trim
(org-babel-expand-body:generic body params))
"\n"
'omit-nulls)))))