astahlman / ob-async

Asynchronous src_block execution for org-babel
343 stars 32 forks source link

Inherit any variables prefixed with "org-babel-" #67

Closed astahlman closed 3 years ago

astahlman commented 3 years ago

See https://github.com/astahlman/ob-async/issues/65 for a motivating example. The user (reasonably) expects that setting org-babel-python-command will take effect in an :async src_block, but it doesn't unless you set this value in the subprocess with a pre-execute hook, i.e.,

  (add-hook 'ob-async-pre-execute-src-block-hook
            '(lambda ()
               (setq org-babel-python-command "python3")))

Instead of requiring the user to recreate the calling context in the subprocess by setting variables in an ob-async-pre-execute-src-block-hook, now we will automatically inherit the values of any variables whose name begins with "org-babel-" in the async subprocess.