0

I want to update to the latest version of Org-mode to test a bug fix. I followed the instructions:

cd ~/src/
git clone https://code.orgmode.org/bzg/org-mode.git
cd org-mode/
make autoloads

Then I launch emacs without initialization:

emacs -nw -q

and evaluate:

(add-to-list 'load-path "~/src/org-mode/lisp") ;; result: ("~/src/org-mode/lisp" ...)
(org-version)  ;; result: "9.1.9"

which shows that it is using the built-in version, not the one from git (the compiled file org-version.el shows "9.3.3").

I was able to install the latest version when I filed the bug report. Then package-list-packages would show the built-in org package as masked by another; I can't remember how I did it and now the built-in package is not masked.

I am on macOS 10.14.6 and GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109)) of 2019-09-02.

I have tried How to update Org to latest version using package repo's / git clone in Ubuntu without success. This thread is for Ubuntu.

What is preventing my machine from using the latest version of org-mode?

| improve this question | | | | |
  • Did you byte-compile the files in the working copy? Emacs first looks for the byte-compiled files. So if your version is not byte-compiled but the built-in version is, the built-in version wins. I think make will do that for you. Run make and afterwards make autoloads. – Tobias Feb 5 at 20:37
  • 1
    I believe it should work without byte-compiling (provided that you add the directory to the front of load-path, as you are doing), but you need to (require 'org-loaddefs). – NickD Feb 5 at 23:28
  • 1
    @NickD You are right. I just tried it: ~/path1/lib.el shadows ~/path2/lib.elc if ~/path1 comes before ~/path2 in load-path even if .elc comes before .el in variable load-suffixes. I checked the doc strings and the info manual comprehensively. The hierarchy of the searches for load-path and load-suffixes is not mentioned anywhere. From my point of view that is a documentation bug. – Tobias Feb 6 at 9:37
2

[As requested, expanding the comment into an answer]

The main idea is that you need to make sure that Org mode is set up, using the new bits that you downloaded only. Emacs comes with a version of Org mode bundled up with it, but that is inevitably older than what is available from the Org mode git repo. It is important to avoid loading any piece from the bundled up version or else you might end up with a "mixed" installation (there are many hits for that on the Org mode mailing list).

As I mention in a comment, and @Tobias has verified in another comment, you do not need to byte-compile the new version - you only need to make autoloads. That creates an org-loaddefs.el file, so that all the common entry points into org will, when first invoked, load the appropriate file first. It is important (and contrary to what the OP states in his (now deleted) comment) to set the load-path before loading the org-loaddefs.el file: otherwise, you may end up with the dreaded "mixed" install I mentioned above.

So after cloning or updating the git repo into, say, ~/src/org-mode, you can do make autoloads (or just make if you want to byte-compile the .el files). Then invoke emacs with an init file like this:

(add-to-list 'load-path "~/src/org-mode/lisp")
(require 'org-loaddefs)

...

and make sure that those two lines are before anything else in the init file, just to make sure that nobody loads any old pieces of org-mode that may be lying around. Setting the load-path to begin with will shadow the old pieces and will prevent them from being loaded later.

The Org mode manual has a section on installing (including a subsection on installing from the git repo).

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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