I have something like (to be simplify)
(require 'package)
(setq package-archives
'(("org" . "http://orgmode.org/elpa/")
("melpa" . "http://melpa.org/packages/")
("melpa-stable" . "http://stable.melpa.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/")))
(setq package-enable-at-startup nil)
(package-initialize t)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(let ((default-directory (expand-file-name user-emacs-directory "elpa")))
(normal-top-level-add-subdirs-to-load-path))
(require 'use-package)
(use-package helm
:ensure t
:commands (helm-M-x
helm-mini
helm-find-files
helm-show-kill-ring)
:init
(add-hook 'after-init-hook 'helm-mode)
:config
(helm-autoresize-mode 1))
in my .emacs
. But I was told that Symbol's function definition is void: helm-mode
after startup emacs.
After reading the manual of Packaging Basics and this answer, I find I still don't understand the mechanism of package.el
.
I notice that the words load
and activate
are used in the manual, I suppose that load
is 'Emacs adds the package’s content directory to load-path, and evaluates the autoload definitions in name-autoloads.el.' and activate
is to 'fully require
'. I know if I change (package-initialize t)
into (package-initialize)
everything will be fine.
I confirm that something like "/Users/gaki/.emacs.d/elpa/helm-20160112.258"
is in load-path
and helm-mode
is autoload
. Isn't it can be autoload and even in the after-init-hook
?