exce-path 比较奇怪,和系统 path 不是一个。但是终端下启动 emacs 是可以直接继承的。windows GUI 好像也可以继承。mac 和 linux 直接从桌面启动 GUI 的话则不能自动继承。
所以,大神已经写好了帮你导入的插件了。
这是我使用的相关配置,
;; GUI 下自动导入 PATH
(use-package exec-path-from-shell
:if (memq window-system '(mac ns x))
:ensure t
:init (setq exec-path-from-shell-check-startup-files nil)
:config (exec-path-from-shell-initialize))
或者如果你不用 use-package 的话:
(setq exec-path-from-shell-check-startup-files nil)
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize))