I read from some posts (require vs. package-initialize?, and here) that Emacs can autoload packages installed via ELPA/MELPA, which avoids using require
on packages and speeds up loading during initialization. And quoting this answer:
Note that for 99% of the packages require should not be needed (the autoloads should cause the package to be loaded as soon as you try to make use of it).
I do have quite a few usages of (require ...)
in my init.el
that significantly slow down emacs initialization. By turning things on and off, some culprits seems to be
(require 'help-fns+) ; about 0.2 to 0.3 s
(require 'org)
(require 'ob-octave) ; not sure, but up to 1 s
I tried to just comment out these require
statements (since I use emacs 27.1 under Ubuntu). But help-fns+.el does not seem to work anymore. Functions defined there (e.g. describe-buffer
) can no longer be found.
My questions are:
Is it the right way to take advantage of autoloads by just removing the require
call? Or is it because help-fns+.el
doesn't have the autoload capability from ELPA?
If the latter case, (how) can I autoload help-fns+.el
and avoid a hard require
in init.el
?