mickesp · 2022-12-15 08:23
I updated packages today (using auto-package-update). After restart, I get a warning in \*Warnings\*:
`Error (use-package): Cannot load helm-config`
And in the top of the \*Messages\* buffer I see:
`Error loading autoloads: (void-function helm-make-source)`
I see in the helm GitHub repo history that helm-config has been removed (like 3 days ago). What is the correct way to install and configure helm now, using use-package? Below is my config for helm:
(use-package helm
:ensure t
:bind
(("M-x" . helm-M-x)
("C-x C-f" . helm-find-files)
("C-x C-b" . helm-buffers-list)
("M-s o" . helm-occur)
("M-s i" . helm-imenu)
("M-s I" . helm-imenu-in-all-buffers)
("M-s m" . helm-mini)
("M-s b" . helm-bookmarks))
:config
(use-package helm-config)
(setq helm-split-window-inside-p t)
(setq helm-use-frame-when-more-than-two-windows nil)
(setq imenu-max-item-length 120)
(setq helm-buffer-max-length nil)
(helm-mode 1)
(helm-autoresize-mode 1))
If I remove the `(use-package helm-config)` part the warning disappears but the error in the \*Messages\* buffer remains, all seems to work though.
In the commit removing helm-config it is replaced with helm-autoloads. Should I replace helm-config with helm-autoloads in my use-package statement? I tried, and it seems to work equally bad or well with the error still in the top of the \*Messages\* buffer.
deaddyfreddy · 2022-12-15 09:09
Did you check the last commit in Helm's GitHub repo?
mickesp · 2022-12-15 10:05
Yes I did, and I believe I said so in the post, but I might have been a bit unclear. The commit removing `helm-config` replaces it with `helm-autoloads`. In the comment to the commit, it says "One can require helm-autoloads when installing from source". Since I'm installing from Melpa I guess I could skip requiring helm-autoloads, but the thing that confuses me is the error message in the top of \*Messages\* that says "Error loading autoloads: (void-function helm-make-source)". This is still there, so I was wondering if I might have to require helm-autoloads anyway.
deaddyfreddy · 2022-12-15 12:08
there's a get started section on Wiki:
(add-to-list 'load-path "/path/to/helm/directory") ; facultative when installed with make install
(use-package helm :config (require 'helm-autoloads))
helm05 · 2022-12-15 15:06
As you are installing Helm from package, you don't need to load helm-autoloads.el yourself, Emacs is taking care of this.
For the other error, because you use \`:bind\`, you are deferring Helm loading until one of the functions are called e.g. helm-M-x etc... BTW \`helm-make-source\` is unknown.
I suggest you use different \`use-package\` calls, one for each package where the command belong e.g. \`(use-package helm-commands :bind (("M-x" . helm-M-x)))\` , this after
\`(use-package helm ...)\` (don't defer helm package loading with :bind or whatever).
See [https://github.com/thierryvolpiatto/emacs-config/blob/main/init-helm.el](https://github.com/thierryvolpiatto/emacs-config/blob/main/init-helm.el).
helm05 · 2022-12-15 15:11
This is when helm is installed from sources, also for some reasons package.el is generating an autoload file without a provide whereas when installing from source with make the autoload file has a provide.
So require on an autoload file without a provide will fail.
Hopefully you don't have to load yourself the autoload file as long as you install from package.
helm05 · 2022-12-15 15:38
So your config above would become something like this:
```
(use-package helm
:ensure t
:config
(setq helm-split-window-inside-p t)
(setq helm-use-frame-when-more-than-two-windows nil)
(helm-autoresize-mode 1))
(use-package helm-mode
:config (helm-mode 1))
(use-package helm-command
:bind (("M-x" . helm-M-x)))
(use-package helm-files
:bind (("C-x C-f" . helm-find-files)))
(use-package helm-buffers
:bind (("C-x C-b" . helm-buffers-list)
("M-s m" . helm-mini))
:config (setq helm-buffer-max-length nil))
(use-package helm-occur
:bind (("M-s o" . helm-occur)))
(use-package helm-imenu
:bind (("M-s i" . helm-imenu))
:config (setq imenu-max-item-length 120))
(use-package helm-bookmarks
:bind (("M-s b" . helm-bookmarks)))
```
mickesp · 2022-12-15 16:14
Thanks for the extensive explanation, I will implement this.
deaddyfreddy · 2022-12-15 16:15
I think `:custom` is preferred for setting vars here because it doesn't `(require 'feature)` while `:config` does. Otherwise, a cool and pretty idiomatic solution!