Skip to content

Instantly share code, notes, and snippets.

Last active July 20, 2018 07:52
Show Gist options
  • Save ertwro/4e1fde4ddcd989ad7e3277df8b7f611a to your computer and use it in GitHub Desktop.
Save ertwro/4e1fde4ddcd989ad7e3277df8b7f611a to your computer and use it in GitHub Desktop.

Issue Reporting Checklist

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")

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 + 354

This 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

Bug Description

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> (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")
  (julia . t)
   (require 'ob-async)
    '((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 + 354

Maybe you can help, but maybe is a Julia thing as is weirdly integrated into ess and babel.

Copy link

So inferior-julia-program-name is void in the Emacs subprocess, which suggests that your init-file isn't initializing that variable in the subprocess. Where does inferior-julia-program-name normally get defined (ignoring ob-async entirely)? For example, my user.el has a (require 'ess-site), which in turn requires ess-custom, which defines inferior-julia-program-name.

Copy link

ertwro commented Jul 20, 2018

Is defined at my init.el That's the reason it recognizes R and the rest of the languages when Julia is commented out or loaded before ob-async. I checked ess-site.el from the GitHub master and elpa-develop and found that the (ess-require 'ess) is no longer set there and requires directly Julia and the other languages without passing through ess.el. The old version of ess-site.el does contain a call to ess-custom.el. Which I try to use in this form, in my init.el:
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ess/")
(load "ess-site")
(require 'ess-site)
(require 'ess)

Even with "M-x Customize-variable inferior-julia-program-name" set to /opt/ or from /usr/local it makes no difference. I've downloaded several versions of Julia and recompiled emacs with different versions of ess.
The behavior is the same. R works fine with :async as do the other languages, that if Julia is commented out or loaded before ob-async.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment