1

This is my config for org-babel:

(use-package org
  :mode (("\\.org$" . org-mode))
  :ensure org-plus-contrib  
   :config
    (org-babel-do-load-languages 'org-babel-load-languages
                           '((emacs-lisp . t)         
                             (python . t)             
                             (shell . t)              
                             (jupyter . t))))

It works when it is located in my init.el. However when I relocate it in another file org.el and load it in init.el with: (load-user-file "org.el") I have got the error:

Symbol's value as variable is void: org-src-lang-modes

Also I have the line ;;; -*- lexical-binding: t -*- and the same encoding in both files (init.el,org.el). So, could you explain me what happens?

UPDATE.

Just for clarification this is my load-user-file :

(defun load-user-file (file)
  (interactive "f")
  "Load a file in current user's configuration directory"
  (load-file (expand-file-name file user-init-dir)))
5
  • 1
    org.el is a bad name: it conflicts with the org.el that is part of Org mode proper. Choose a different name for your file.
    – NickD
    Commented Sep 14, 2019 at 18:32
  • Is load-user-file a thing? I've only see load-file. Commented Sep 18, 2019 at 12:40
  • @NickD your comment has solved my problem. If you edit your comment as answer I will close the issue.
    – Pfedj
    Commented Sep 21, 2019 at 19:31
  • @ChrisClark could you clarify your question?
    – Pfedj
    Commented Sep 21, 2019 at 19:33
  • 1
    @ChrisClark refers to this line in your question: ...with: (load-user-file "org.el") I have got the error:... and he is (correctly I think) wondering about that load-user-file: standard emacs only provides load-file so this is either a typo or you are using some non-standard package that defines load-user-file.
    – NickD
    Commented Sep 21, 2019 at 20:06

1 Answer 1

2

The name org.el is a bad name for your file, because it conflicts with the org.el file that is part of Org mode. When emacs is asked to load org.el, which one will be loaded is determined by how emacs's load-path variable is defined, but in any case you will not be able to load both, so either your functionality will be missing or Org mode might be broken.

The solution is to rename your file to a unique name that will not cause a conflict.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.