将二进制路径添加到emacs $ PATH [英] Adding binary path to emacs $PATH
问题描述
我尝试了以下操作:
(setenv "PATH" (concat (getenv "PATH") ":~/mybin"))
(setq exec-path (append exec-path '(":~/mybin")))
但是那从来没有奏效.我尝试过M-!并在执行二进制名称相同的结果的M-x编译时,键入其中一个二进制名称并且给出了未知命令".M-x编译然后回显$ PATH给出了没有我的〜/mybin文件夹的路径.我在晒太阳.我在做什么错了?
But that never worked. I tried M-! and typing one of the binary names and that gave "unknown command" also when doing M-x compile with the binary name same result. M-x compile then echo $PATH gave the path without my ~/mybin folder in it. I am on solaris. What am I doing wrong?
推荐答案
:
. exec-path
是目录路径的列表.并且您应该使用绝对路径.您应按以下步骤进行修复.
:
is not needed for exec-path. exec-path
is list of directory paths.
And you should use absolute paths. You should fix as below.
(setenv "PATH" (concat (getenv "PATH") ":" (expand-file-name "~/mybin")))
(setq exec-path (append exec-path (list (expand-file-name "~/mybin")))
我建议您使用 exec-path-from-shell 进行设置到Emacs的路径.它提供了一些函数,这些函数从您的登录Shell中获取环境变量并将其设置为Emacs.在Emacs和Shell之间共享环境变量很容易.
I recommend you to use exec-path-from-shell for setting PATH to Emacs. It provides functions which get environment variables from your login shell and set them to Emacs. It is easy to share environment variables between Emacs and shell.
这篇关于将二进制路径添加到emacs $ PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!