How can I ensure I'm downloading and using org-plus-contrib
from the org-mode repository using require
or use-package
? Package.el
downloads the package, compiles everything and then says it can't load org-plus-contrib
. This thread on the mailing list discusses a similar, but inverted problem. However, if I place (use-package org ...
, use-package
returns t
, but does so whether org-plus-contrib
is installed or not.

- 3,657
- 2
- 27
- 46
-
Why not simply `(use-package org-plus-contrib :ensure t)`? Granted that I'm using cask with pallet for package managment, but it places */home/kmicu/.emacs.d/.cask/24.4.1/elpa/org-plus-contrib-20150202* in my path and loads it. – kmicu Feb 02 '15 at 21:57
-
Remember that *org-plus-contrib* contains *org* files **plus** all contribs files. You should install *org* xor *org-plus-contrib*, but not both. – kmicu Feb 02 '15 at 22:08
-
Maybe you can try with `package-pinned-packages` – csantosb Feb 03 '15 at 22:07
3 Answers
The correct way to do this with use-package is as follows:
(use-package org
:ensure org-plus-contrib
...
The first argument makes sure that it is the org.el file being sourced. The :ensure argument makes sure that you are getting the version with all the extras. Of course you also need to have ("org" . "http://orgmode.org/elpa/")
in your package-archives alist.

- 291
- 2
- 4
-
-
I'm using this in my config, but whenever a third-party package (e.g., elfeed-org) gets installed with use-package, the default org is downloaded and installed. This cannot be right, any ideas how I can prevent that from happening? – andreas-h Oct 07 '17 at 22:04
-
@AlfredM. that's not mentioned in orgmode.org/elpa.html anymore – Günter Zöchbauer May 11 '20 at 07:17
I'm not 100% sure you can really reliably check with only require
or use-package
... But if you are using package.el for org-mode functionality, your org-mode configuration may need to be deferred until after your packages have been initialized. You can do this with a hook the runs after Emacs has initialized called "after-init-hook
".
So...
That means in your .emacs
, you'll need a hook like:
(add-hook 'after-init-hook 'package-config)
And somewhere else:
(defun package-config ()
;;Your org-mode config goes here.
)
After that, you have access to package.el's checking and downloading functionality...
so, since you also want to check for the package's existence, you can use "(package-installed-p 'org-plus-contrib)
" and install it with "(package-install package)
" if it is not there.
Altogether, the code would probably look something like:
(defun package-config ()
(unless (package-installed-p 'org-plus-contrib)
(package-refresh-contents)
(package-install 'org-plus-contrib)))
(add-hook 'after-init-hook 'package-config)
With the rest of your config being after the (unless ...)
body.
That way, you get your configuration, you get your package install checking, and you get it automatically downloaded so you can safely assume that anything past that line in the function can use the loaded contribs. (Assuming you have a network connection if it doesn't exist.)

- 2,106
- 16
- 17
I do a package-install org-plus-contrib manually, but then subsequently do use-package org. Finally, a subsequent M-x org-version indicates that the org provided by org-plus-contrib is indeed used and all is well.

- 541
- 3
- 14