8

How do you trouble shoot this? (trying to run a sh block async)

#+BEGIN_SRC sh                                                                                                   
/tmp/7.sh                                                                                                        
#+END_SRC

Then I do

C-c C-c

I get

Symbol's function definition is void: org-babel-get-header

My setup

prelude emacs25 org installed

;; my ~/prelude/personal/personal.el
(prelude-require-package 'ob-async)                                                                              
(require 'ob-async)   
(setq org-confirm-babel-evaluate nil)                                                                            

(org-babel-do-load-languages                                                                                     
 'org-babel-load-languages                                                                                       
 '(                                                                                                              
   (sh . t)                                                                                                      
   (ruby . t)                                                                                                    
   ))  
Drew
  • 75,699
  • 9
  • 109
  • 225
american-ninja-warrior
  • 3,773
  • 2
  • 21
  • 40
  • 1
    Possible duplicate of [How to remove cause of an error in loading .emacs: Symbol's function definition is void: defvar-local](https://emacs.stackexchange.com/questions/28028/how-to-remove-cause-of-an-error-in-loading-emacs-symbols-function-definition) – Drew Dec 22 '17 at 18:54
  • 1
    There are (today) 34 questions with a match for `function definition is void`: https://emacs.stackexchange.com/search?q=%22function+definition+is+void%22 The error always means the same thing, in the immediate sense, though the proper remedy can be different in different cases (e.g. trying to use a variable as a function, package not loaded yet, wrong Emacs version). The most common cause is not first loading the needed library. It would be great if someone *carefully* consolidated most or all of those questions into a new, generic, community question with a good answer. – Drew Dec 22 '17 at 18:58

1 Answers1

12

According to https://lists.gnu.org/archive/html/emacs-orgmode/2015-11/msg00425.html ob-sh was renamed ob-shell in org 8.2 ... and I cite from there:

org-babel-get-header was removed in 0d000f5 (babel: small change in API., 2015-10-29), but the old ob-sh.el is still trying to call it.

That means you should replace (sh . t) by (shell . t) in your call of org-babel-do-load-languages. And don't forget to re-start emacs afterwards! ;-)

EDIT: You don't need to to change the source language of your source code blocks from sh to shell. It is only important to call org-babel-shell-initialize.

The source code languages that are supported by ob-shell are defined in the option org-babel-shell-names (which can be customized).

The default value of org-babel-shell-names is:

'("sh" "bash" "csh" "ash" "dash" "ksh" "mksh" "posh")

From these names org-babel-execute:... functions are generated by org-babel-shell-initialize.

Tobias
  • 32,569
  • 1
  • 34
  • 75