Search code examples
org-mode

Emacs sees the directory with the new org-mode version, but loads the old version


The version of org-mode that came with my version of Emacs (24.5.2) is 8.2.10. I have installed version 8.3.1 from ELPA and added this to my init file:

(add-to-list 'load-path "~/.emacs.d/org-20150803")
(require 'org)

When I check the version of org in Emacs, it says:

Org-mode version 8.2.10 (release_8.2.10 @ /home/meir/.emacs.d/elpa/org-20150803/)

That is, it reports the old version and the new directory... (the built-in version is located in /usr/local/share/emacs/24.5/lisp/org)

I have tried the solutions proposed here and here.

Here is the relevant portion of my init file (there is nothing before this portion):

(require 'cl)

;; Org-mode that was shipped with Emacs
(setq load-path (remove-if (lambda (x) (string-match-p "org$" x)) load-path))
;; ELPA
(setq load-path (remove-if (lambda (x) (string-match-p "org-20" x)) load-path))

(add-to-list 'load-path "~/.emacs.d/org-20150803")

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)

(require 'org)

How do I get Emacs to load the new version of org-mode?

UPDATE: I renamed /usr/local/share/emacs/24.5/lisp/org to be /usr/local/share/emacs/24.5/lisp/org1, so Emacs for sure cannot see the built-in version. However, it still shows the old version number!..


Solution

  • I recommend you start over by deleting any personally installed versions of org:

    rm -rf ~/.emacs.d/elpa/org-* # your installation path _may_ vary.
    

    and then

    • ensure that when you build org from elpa you have not already loaded org.
    • decide which version of org you want and the package archive from which it comes.

    For instance, if you, like me, want org-plus-contrib from http://orgmode.org/elpa, first you should:

    > emacs -Q -batch -eval "(progn (require 'package) (add-to-list 'package-archives '(\"org\" . \"http://orgmode.org/elpa/\"))  (package-initialize) (package-refresh-contents) (package-install 'org-plus-contrib))"
    

    Then, confirm success by quitting emacs and restarting as:

    > emacs -q -eval "(progn (require 'package) (package-initialize))" 
    meta-x org-version
    

    Notes:

    • if you do NOT include -eval "(progn (require 'package) (package-initialize))" then org-version will likely be autoloaded from whatever you have installed in .../site-lisp - probably an old version
    • regular 'org package is also available at http://orgmode.org/elpa - c.f. http://orgmode.org/elpa.html for differences