mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 19:37:52 +00:00
ob-J.el: Add ability to customize sit duration
* lisp/ob-J.el (org-babel-execute:J, org-babel-J-eval-string): Add customizability. (org-babel-execute:J): Lookup optional parameter `:sit' to allow one to wait for a specified amount of time before grabbing the output of the J subprocess. Pass this specified value or the previous default of .1 to `org-babel-J-eval-string'. (org-babel-eval-string): Pass new argument `sit-time' to `sit-for' before grabbing output. The problem is that we read the contents of the output after 0.1 seconds, which, for expensive computations, results in the mangling of output. Output from expensive computations gets propagated down to subsequent code-blocks' outputs, producing a horrible mess. TINYCHANGE
This commit is contained in:
parent
7b657c50e7
commit
7d8247410d
|
@ -76,6 +76,8 @@ This function is called by `org-babel-execute-src-block'."
|
|||
(message "executing J source code block")
|
||||
(let* ((processed-params (org-babel-process-params params))
|
||||
(sessionp (cdr (assq :session params)))
|
||||
(sit-time (let ((sit (assq :sit params)))
|
||||
(if sit (cdr sit) .1)))
|
||||
(full-body (org-babel-expand-body:J
|
||||
body params processed-params))
|
||||
(tmp-script-file (org-babel-temp-file "J-src")))
|
||||
|
@ -86,9 +88,9 @@ This function is called by `org-babel-execute-src-block'."
|
|||
(with-temp-file tmp-script-file
|
||||
(insert full-body))
|
||||
(org-babel-eval (format "%s < %s" org-babel-J-command tmp-script-file) ""))
|
||||
(org-babel-J-eval-string full-body)))))
|
||||
(org-babel-J-eval-string full-body sit-time)))))
|
||||
|
||||
(defun org-babel-J-eval-string (str)
|
||||
(defun org-babel-J-eval-string (str sit-time)
|
||||
"Sends STR to the `j-console-cmd' session and executes it."
|
||||
(let ((session (j-console-ensure-session)))
|
||||
(with-current-buffer (process-buffer session)
|
||||
|
@ -96,7 +98,7 @@ This function is called by `org-babel-execute-src-block'."
|
|||
(insert (format "\n%s\n" str))
|
||||
(let ((beg (point)))
|
||||
(comint-send-input)
|
||||
(sit-for .1)
|
||||
(sit-for sit-time)
|
||||
(buffer-substring-no-properties
|
||||
beg (point-max))))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue