Helm: (require 'helm-config) not working after installing Helm via MELPA.

Created on 10 Dec 2014  路  7Comments  路  Source: emacs-helm/helm

I added melpa.org to my list of packages, and installed helm through the package-list-packages UI.

The Helm instructions indicate that the only additional step necessary is to add (require 'helm-config) to my init file, which I did, but if I do this, I get the following error at start-up:

Warning (initialization): An error occurred while loading `/Users/radix/.emacs':

File error: Cannot open load file, no such file or directory, helm-config

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

However, I can still manually start helm-mode interactively after startup with M-x helm-mode.

The version of Helm I have from MELPA is 20141210.640. The version of Emacs I am using is

GNU Emacs 24.4.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
 of 2014-10-20 on builder10-9.porkrind.org

Most helpful comment

Tu Do [email protected] writes:

Did you put (package-initialize) before loading helm-config?

Exactly if you don't add this to your init file the helm directory will
not be in load-path.
So if you install from melpa:
(package-initialize)
(require 'helm-config)

if you install from git:
(add-to-list 'load-path ...)
(require 'helm-confih)

Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

All 7 comments

As a work-around, it seems I can put the following snippet in my .emacs to get helm loading at start:

(add-hook
 'after-init-hook
 (lambda ()
   (require 'helm-config)
   (helm-mode 1)))

Is this what the documentation should suggest instead of a bare (require 'helm-config)?

Did you put (package-initialize) before loading helm-config?

@tuhdo - I didn't. If I do that, and add (require 'helm-config) and (helm-mode 1) after that, it also works. Is that the recommended way to enable helm after installing it via MELPA?

Tu Do [email protected] writes:

Did you put (package-initialize) before loading helm-config?

Exactly if you don't add this to your init file the helm directory will
not be in load-path.
So if you install from melpa:
(package-initialize)
(require 'helm-config)

if you install from git:
(add-to-list 'load-path ...)
(require 'helm-confih)

Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

@radix it is recommended for all Melpa installed packages. You must put that line at the very beginning of your init file to make packages installed from Melpa available to be used.

I checked out the documentation for the package system in Emacs.

https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html

According to this, we should also have (setq package-enable-at-startup nil) in our init file if we're using package-initialize.

It's still a pretty bad user experience to not be able to just follow the instructions in the Helm README with a stock installation of Emacs. Maybe the README should instead document using the after-init-hook? AFAICT that would work 100% of the time. But if not that, then perhaps helm's README should just mention that the (require) line at top-level will need a (setq package-enable-at-startup nil) (package-initialize) as well.

another point is that it seems it should say to add the (helm-mode 1) line, because otherwise helm won't be enabled, just loaded.

I'd be happy to submit a PR to make these changes, if we can come to a conclusion about what changes should be made.

Christopher Armstrong [email protected] writes:

I checked out the documentation for the package system in Emacs.

https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html

According to this, we should also have (setq package-enable-at-startup
nil) in our init file if we're using package-initialize.

It's still a pretty bad user experience to not be able to just follow
the instructions in the Helm README with a stock installation of
Emacs. Maybe the README should instead document using the
after-init-hook? AFAICT that would work 100% of the time. But if not
that, then perhaps helm's README should just mention that the
(require) line at top-level will need a (setq
package-enable-at-startup nil) (package-initialize) as well.

Helm is documenting how to install helm, for generality about package.el
you should read on the emacs documentation about how installing and
using packages in emacs.

another point is that it seems it should say to add the (helm-mode 1)
line, because otherwise helm won't be enabled, just loaded.

No, this is not mandatory, you can use helm without enabling helm-mode.

I'd be happy to submit a PR to make these changes, if we can come to a
conclusion about what changes should be made.

Thanks, but there is nothing to change here, what you want to document
have nothing to do with helm, only package.el usage.

So when the helm README say to require helm-config, we assume you have
already installed helm with package.el and you know how to use it, that
is adding (package-initialize) on top of your init file.

See:
https://github.com/milkypostman/melpa#usage

Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Was this page helpful?
0 / 5 - 0 ratings