eshell (elisp shell) 启动时读取什么设置文件? eshell 如何设置它的 PATH?
使用 emacs/eshell,“echo $PATH”显示与 $PATH 环境变量不同的路径。
我还检查了 eshell 不读取 .bashrc 或 .profile,我认为这就是路径不同的原因。
- eshell 启动时读取什么设置文件?
- eshell 如何设置它的 PATH?
- 如何使eshell的PATH与环境变量的PATH相同?
添加
正如 Jérôme Radix 指出的那样,路径取决于我如何启动 Aquamcs。
- 当我单击按钮启动 Aquamacs 时,它有不同的路径。
- 当我从命令行运行“aquamacs”时,它具有相同的路径。
With emacs/eshell, the "echo $PATH" shows different paths than that of $PATH environment variable.
And I also checked that eshell doesn't read .bashrc or .profile, and I think that's the reason why the path is different.
- What setup file does eshell read when it starts?
- How eshell sets its PATH?
- How to make the eshell's PATH the same as the environment variable's PATH?
ADDED
As Jérôme Radix pointed out, the PATH depends on how I start the Aquamcs.
- When I click the button to start Aquamacs, it has different PATH.
- When I run 'aquamacs' from the command line, it has the same PATH.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
启动时不执行安装文件。读取以下文件来定义初始历史记录和最后目录:
In esh-util.el,第 240 行:
与emacs进程的PATH变量相同。我想象你在 emacs 外部的 shell 上执行 echo $PATH 来进行比较。如果 emacs 和 emacs 外部的 shell 之间的 PATH 不同,那是因为 emacs 和您的 shell 不执行相同的启动脚本。
No setup file is executed at startup. The following files are read to define the initial history and last directories :
In esh-util.el, line 240 :
It is the same as the PATH variable of the emacs process. I imagine that you do a echo $PATH on a shell outside emacs to compare. If PATH are differents between emacs and your shell outside emacs it is because emacs and your shell does not execute the same startup scripts.
由于您使用的是 Mac,因此重要的是要知道 GUI 应用程序(例如未从终端打开时的 Aquamacs)从
~/.MacOSX/environment.plist
获取其环境,以便您可以进行更改那里。请特别参阅 Brian D Foy 撰写的这篇文章,了解自动构建此文件的方法。Since you are on a Mac, it's important to know that GUI applications (such as Aquamacs when not opened from a terminal) get their environment from
~/.MacOSX/environment.plist
, so you can make changes there. See in particular this article by Brian D Foy for a way to build this file automatically.根据定义,
echo $PATH
显示PATH
环境变量的值。在 Emacs 中运行的 shell 从正在运行的 Emacs 进程继承PATH
环境变量。<编辑>
在
eshell
中运行的 shell 不像 bash 那样是一个单独的程序,它内置于 Emacs 中。它的定制是通过 Emacs Lisp 完成的。特别是,当 eshell 启动时,它会运行eshell-mode-hook
中的函数并加载eshell-modules-list
中的 Lisp 文件。您似乎没有在正确的配置文件中设置
PATH
。正确的位置应该是在会话开始时完成的事情。这取决于操作系统;如果您遇到问题,请询问超级用户,确保说出您的操作系统是什么,如果适用,请指出您的登录 shell、桌面环境等By definition,
echo $PATH
shows the value of thePATH
environment variable. The shell running inside Emacs inherits thePATH
environment variable from the running Emacs process.<EDIT>
The shell running in
eshell
is not a separate program like bash, it's built into Emacs. Its customization is done through Emacs Lisp. In particular, when eshell starts, it runs the functions ineshell-mode-hook
and loads the Lisp files ineshell-modules-list
.</EDIT>
It looks like you're not setting
PATH
in the right configuration file. The right place would be something that's done at the start of your session. This is operating system-dependent; if you have trouble with that, ask on Super User, making sure to say what your operating system is, and if applicable indicate your login shell, desktop environment, etc.