自 去掉exec-path-from-shell加快两秒启动时间 继续讨论:
文档上说 eval-when-compile
可以在 byte-compile 期间就会把值计算出来,所以这样的配置编译之后再加载应该会快一些了:
(use-package exec-path-from-shell
:if (eq window-system 'ns) ; Only for the official Cocoa Emacs
:ensure t
:defer t
:init
(let ((path (eval-when-compile
(require 'exec-path-from-shell)
(exec-path-from-shell-getenv "PATH"))))
(setenv "PATH" path)
(setq exec-path (append (parse-colon-path path) (list exec-directory)))))