如何在加载所有安装包后评估一段elisp代码?

时间:2012-06-15 02:48:23

标签: emacs elisp

我已经M-x install-package安装了几个Emacs包。 starter-kit软件包隐藏了emacs的工具栏和菜单栏,但我想让它们显示出来。

我添加了

(tool-bar-mode t)

在我的〜/ .emacs文件中,但在加载starter-kit包之前似乎得到了评估。

如果我想在所有已安装的软件包完成加载后对它们进行评估,我应该把这些代码放在哪里?

2 个答案:

答案 0 :(得分:2)

假设入门套件包在名为" starter-kit"的库中,这应该可行:

(eval-after-load "starter-kit"
   '(tool-bar-mode t))

答案 1 :(得分:1)

查看package.el文件,特别是:

(defcustom package-enable-at-startup t
  "Whether to activate installed packages when Emacs starts.
If non-nil, packages are activated after reading the init file
and before `after-init-hook'.  Activation is not done if
`user-init-file' is nil (e.g. Emacs was started with \"-q\").

Even if the value is nil, you can type \\[package-initialize] to
activate the package system at any time."
  :type 'boolean
  :group 'package
 :version "24.1")

因此,您可以在package-initialize的早期致电.emacs,然后覆盖您需要的内容,例如tool-bar-mode

你也可以将你的覆盖物放在after-init-hook

相关问题