eval-after-load

当我使用wl-install-elisp-from-emacswiki更新anythinganything-config之后,发现我对它们做的定制不见了。

解决方法是使用eval-after-load,在每次加载一个文件的时候运行一段代码,如下:

(eval-after-load 'anything
  '(progn
     (setq anything-enable-digit-shortcuts t)
     (global-set-key (kbd "<f9>") 'anything)))

(eval-after-load 'anything-config
  '(add-to-list 'anything-sources anything-c-source-file-cache))

注意,第二个参数是个list,一定要quote,不然他们会立刻执行。

5 thoughts on “eval-after-load

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据