Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org-babel-load-languages has issues in v104.2 #3314

Closed
liangwang opened this issue Oct 9, 2015 · 11 comments
Closed

org-babel-load-languages has issues in v104.2 #3314

liangwang opened this issue Oct 9, 2015 · 11 comments
Labels

Comments

@liangwang
Copy link

To enable python code evaluation in org-mode, the org-babel document suggests the following:

     (org-babel-do-load-languages
      'org-babel-load-languages
      '((python . t)))

Prior v104.x, it works by putting the above code in dotspacemacs/config. After upgrade to v104.2, if the above code is put in dotspacemacs/user-config, emacs throws the following error at startup:

Invalid function: org-babel-header-args-safe-fn

When move the code into dotspacemacs/user-init, emacs starts without any error messages. But autofill within org file does not work. Emacs will show the error message as follows:

An element cannot be parsed line xxx

BTW, is dotspacemacs/user-config and/or dotspacemacs/user-init the right place to put org-mode related customizations?

@TheBB
Copy link
Collaborator

TheBB commented Oct 9, 2015

I'm not sure why it doesn't work, but certainly it has to go in user-config. Otherwise org will not yet have been configured by Spacemacs.

Can I ask for your SPC hds output?

@TheBB TheBB added the Org label Oct 9, 2015
@TheBB
Copy link
Collaborator

TheBB commented Oct 9, 2015

https://lists.gnu.org/archive/html/emacs-orgmode/2015-08/msg00254.html

Might be an error in org-plus-contrib. Try updating it and see if it works for you. It does for me...

@liangwang
Copy link
Author

It is related to the old "org" package installed by spacemacs v103: after upgrade to v104, the "org" package is not deleted automatically, and messes up with new org-plus-contrib package. It works for me right now after manually delete the old "org".

Besides, I would really appreciate if the document (either spacemacs or org layer) can provides some examples/tutorials on how to wrap customized org settings into a personal private layer. Putting everything within user-config seems a little messy to me.

@TheBB
Copy link
Collaborator

TheBB commented Oct 16, 2015

Thanks! You can read doc/LAYERS.org for some info about how to write layers. It doesn't cover org specifically, but it might still help you. I think #3277 should cover the org specific documentation problems. I'm closing this, then.

@TheBB TheBB closed this as completed Oct 16, 2015
@liangwang
Copy link
Author

Update on this issue:

I could reproduce the issue with the following steps:

  1. Make a fresh spacemacs install using git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

  2. Make sure the spacemacs configuration enables the org layer. and has the following settings in spacemacs/user-config

     (org-babel-do-load-languages
      'org-babel-load-languages
      '((R . t)
        (python . t)))
  3. Launch emacs. After spacemacs installs all packages, exit spacemacs. Then you can find both org and org-plus-contrib under ~/.emacs.d/elpa

  4. Launch emacs again, you will see Invalid function: org-babel-header-args-safe-fn at the bottom shortly after it says spacemacs is ready.

The following workaround works for me:

  1. Delete org and org-plus-contrib under ~/.emacs.d/elpa
  2. Launch emacs again, and this time, spacemacs will only install org-plus-contrib. Then exit emacs
  3. Launch emacs, no org-babel-header-args-safe-fn error anymore.

@tommyjiang
Copy link

Thanks @liangwang for providing this solution to solve this problem.

@markhuyong
Copy link

if you have ob-R in your config, then remove it.ob-R

longouyang pushed a commit to longouyang/dot-emacs that referenced this issue Oct 4, 2016
Was getting:

Invalid function: org-babel-header-args-safe-fn

Turns out you don't need to load R as a language anymore, HT syl20bnr/spacemacs#3314 (comment)
@devminz
Copy link

devminz commented Feb 17, 2017

for my case ( emacs newbie < 1m ) I faced same issue for elixir layer.
Got it resolved just by removing all *.elc files in .emacs and restarting emacs.

@biocyberman
Copy link

biocyberman commented Jun 28, 2018

This single error has caused me quite a headache. I finally found a specific solution for my case (because org is not installed, and org-plus-contrib has been installed correctly). Thanks to this blog post:
https://sort-care.github.io/Emacs-Invalid-function-org-babel-header-args-safe-fn/
In essence, the evil line was:

      (org-babel-do-load-languages
      'org-babel-load-languages
      '(
        (python . t)
        (R . t) ; this one is causing problem.
       )
       )

The solution is to run SPC SPC byte-compile-file ./elpa/org-plus-contrib-20180625/ob-R.el. You have to run this, even though you might see the .elc file there already.

@QikeLi
Copy link

QikeLi commented Jul 12, 2018

The solution from @ biocyberman solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants