Emacs initialization as org file: how can I get the right version of org-mode

emacsorg-mode

I've been experimenting with the org-babel tutorial that describes how to put the bulk of your emacs init.el file into an org file. However, I would like to use org-mode 8 (mainly for the new exporter) and I'm on gnu emacs 24.3.1 (for windows) which comes with org-mode 7.9 built-in, so I have org-mode installed from the elpa package manager instead of using the built-in version.

My problem is that emacs loads the org-mode that comes with emacs rather than the one I have installed in elpa. Is there a way to load the elpa org-mode?

Here is my init.el, modified from the org-babel tutorial to point (I thought) to my org-mode distribution – but my emacs-lisp knowledge is minimal so I don't really know what it is doing.

;;; From http://orgmode.org/worg/org-contrib/babel/intro.html#literate-programming
;;; init.el --- Where all the magic begins
;;
;; This file loads Org-mode and then loads the rest of our Emacs initialization from Emacs lisp
;; embedded in literate Org-mode files.
;; Load up Org Mode and (now included) Org Babel for elisp embedded in Org Mode files
(setq dotfiles-dir (file-name-directory (or (buffer-file-name) load-file-name)))
(let* ((org-dir (expand-file-name
             "elpa" (expand-file-name
                     "org-plus-contrib-20130624" )))
  (org-contrib-dir (expand-file-name
                     "lisp" (expand-file-name
                             "contrib" (expand-file-name
                                        ".." org-dir))))
       (load-path (append (list org-dir org-contrib-dir)
                      (or load-path nil))))
  ;; load up Org-mode and Org-babel
  (require 'org-install)
  (require 'ob-tangle))

;; load up all literate org-mode files in this directory
(mapc #'org-babel-load-file (directory-files dotfiles-dir t "\\.org$"))

;;; init.el ends here

Best Answer

Put (package-initialize) before any calls to org-babel-load-file or any other Org function, and you'll get the ELPA version.

Related Topic