请教systemd --user启动路径的问题

使用systemd --user启动emacs后台时,无法继承login bash的路径设置,看到网上大多是在emacs.service中写environment,即使这么做了,编译latex之后仍然提示找不到阅读器(~/bin中),archlinux wiki中推荐配置.pam_environment,不知道大家怎么解决这个问题。

(setenv "PATH"
	(concat
	 (format "%s/%s:" (getenv "HOME") ".cargo/bin")
	 (format "%s/%s:" (getenv "HOME") ".rbenv/shims")
         (format "%s/%s:" (getenv "HOME") ".rbenv/bin")
	 (format "%s/%s:" (getenv "HOME") ".cabal/bin")
	 (format "%s/%s:" (getenv "HOME") ".config/composer/vendor/bin")
	 (getenv "PATH")))

个人不建议为了emacs中的PATH去配systemd全局变量,service还是写的尽量简单点。这个在Emacs里配置就好了

除了Emacs中手动设置PATH,或者用这个包 exec-path-from-shell自动从你的.bashrc或.profile中加载, 比如我的配置(除了默认的path外,我还想要lc_all和lang)

;; fix PATH for emacs in Mac OS X
(require 'exec-path-from-shell)
(push "LC_ALL" exec-path-from-shell-variables)
(push "LANG" exec-path-from-shell-variables)
;; (push "PYTHONPATH" exec-path-from-shell-variables)
(exec-path-from-shell-initialize)

早就知道exec-path-from-shell这个包,一直以为只是Mac os能用,明早试试