This checklist will help you diagnose problems with your ob-async
setup.
Execute the src blocks one at a time with ctrl-c ctrl-c to
ensure that ob-async-org-babel-execute-src-block is used for files
with the :async header-arg. If by the end of this file your issue
isn’t solved, open an issue on Github with the contents of this file.
First, make sure you can execute emacs-lisp src blocks without the async header argument. Otherwise you’ve got bigger problems, and none of this is going to work.
(message "Yes, I can synchronously execute emacs-lisp from an org-babel src block.")Have you installed the ctrl-c ctrl-c hook as described in the
README? If so, you should see ob-async-org-babel-execute-src-block
in this list.
(message "%s" org-ctrl-c-ctrl-c-hook)Fine it is nil, but there is no reference to having to manually add a hook inside the README and I see this inside ~/.emacs.d/elpa/ob-async-20180410.2058/ob-async.el :
((not orig-fun) (warn "ob-async-org-babel-execute-src-block is no longer needed in org-ctrl-c-ctrl-c-hook") nil)
From where are you loading ob-async?
(symbol-file 'ob-async-org-babel-execute-src-block)(message "PID: %s\nEmacs version: %s\norg version: %s\nPath to org: %s" (emacs-pid) (emacs-version) (org-version) (symbol-file 'org-version))Execution of the :async block occurs in an Emacs subprocess. Are you using a consistent version of emacs and org-mode across both processes? Compare the output of this block the output of the previous block.
(message "PID: %s\nEmacs version: %s\norg version: %s\nPath to org: %s" (emacs-pid) (emacs-version) (org-version) (symbol-file 'org-version))If you’re using a consistent version and still facing problems, turn on async debugging.
(setq async-debug t)After (setq async-debug t) I am now retrying it:
(message "PID: %s\nEmacs version: %s\norg version: %s\nPath to org: %s" (emacs-pid) (emacs-version) (org-version) (symbol-file 'org-version))Is showing no output up here, but it does in the minibuffer.
If possible, replace the following block with a block that reproduces your problem, then execute it.
1 + 354This is the elisp that was sent to the Emacs subprocess. If there’s still nothing obviously wrong, file an issue on GitHub and include the contents of this file as a Gist.
(switch-to-buffer "*Messages*")
(goto-char (point-max))
(re-search-backward "Transmitting sexp {{{\\([^}]+\\)}}}")
(match-string 1)
It shows this as it ends the evaluation in the minibuffer.
error in process sentinel: async-handle-result: Symbol’s value as variable is void: inferior-julia-program-name error in process sentinel: Symbol’s value as variable is void: inferior-julia-program-name
I used M-x toggle-debug-on-error to see where the error was occuring and got this:
Debugger entered--Lisp error: (void-variable inferior-julia-program-name)
signal(void-variable (inferior-julia-program-name))
async-handle-result((lambda (result) (with-current-buffer #<buffer troubleshotingorgfilegist01.org> (save-excursion (goto-char (point-min)) (re-search-forward "5b9fab2bcbb878648065c5d2bf0630c2") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "replace" "value" "drawer") (:result-type . value) (:results . "replace value drawer") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "replace" "value" "drawer") (:result-type . value) (:results . "replace value drawer") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "replace" "value" "drawer") (:result-type . value) (:results . "replace value drawer") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "replace" "value" "drawer") (:result-type . value) (:results . "replace value drawer") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("replace" "value" "drawer"))))))) (org-babel-insert-result result '("replace" "value" "drawer") '("julia" "1 + 354" ((:colname-names) (:rowname-names) (:result-params "replace" "value" "drawer") (:result-type . value) (:results . "replace value drawer") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:async)) "" nil 3118 "(ref:%s)") 'nil '"julia") (run-hooks 'org-babel-after-execute-hook))))) (async-signal (void-variable inferior-julia-program-name)) #<buffer *emacs*<9>>)
async-when-done(#<process emacs> "finished\n")
So I decided to try and load ob-julia before I loaded the rest of the babel languages and ob-async
(setq inferior-julia-program-name "/usr/local/bin/julia")
(org-babel-do-load-languages
'org-babel-load-languages
'(
(julia . t)
))
(require 'ob-async)
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(org . t)
(shell . t) ;; was (sh . t)
(ipython . t)
(python . t)
(latex . t)
; (julia . t)
(ditaa . t)
(js . t)
(R . t)
))As a result not only do the other languages work with :async, also julia works properly without async.
sleep 3s && echo 'Done, mate!'Even this works asynchronously.
(message "PID: %s\nEmacs version: %s\norg version: %s\nPath to org: %s" (emacs-pid) (emacs-version) (org-version) (symbol-file 'org-version))1 + 354Maybe you can help, but maybe is a Julia thing as is weirdly integrated into ess and babel.
So
inferior-julia-program-nameis void in the Emacs subprocess, which suggests that your init-file isn't initializing that variable in the subprocess. Where doesinferior-julia-program-namenormally get defined (ignoring ob-async entirely)? For example, myuser.elhas a(require 'ess-site), which in turn requiresess-custom, which definesinferior-julia-program-name.