对于 Emacs,您可以在 .emacs.d/init_bash.sh 中定义您的 shell 模式别名,但 Aquamacs(OS X 10.5 上的 2.0)似乎没有使用它。还有其他地方可以定义这些吗?
2 回答
来自 shell.el:
如果文件
~/.emacs_SHELLNAME' exists, or
~/.emacs.d/init_SHELLNAME.sh',它作为初始输入给出(但由于时间错误,如果 shell 在启动时丢弃输入,这可能会丢失)。缓冲区处于 Shell 模式,提供发送输入和控制 Shell 子作业的命令。请参阅shell-mode'. See also the variable
shell-prompt-pattern'。
因此,您可能想尝试查看~/.emacs_bash是否有效。
为我解决了:我做了两个似乎可以解决问题的更改(我之前做过 Aquamacs -> 工具 -> 安装命令行工具)。更改是: a) 删除我创建的 '~/.emacs_bash' 符号链接;b) 创建一个“~/.bashrc”文件,其中包含对我的别名设置脚本的调用;c) 从 '~/.bash_profile' 调用 '~/.bashrc'(将导出的环境变量留在它们所属的 ~/'.bash_profile' 中)。
Aquamacs 似乎将 '/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin' 附加到它从 '~/.bash_profile' 获取的路径中,但这似乎不是问题。
- 我之前的回答和问题:
从 '~/.emacs_bash' 到 '~/.bash_profile' 的符号链接成功地让 '~/.bash_profile' 在 Aquamacs 上执行,因此 shell 缓冲区具有一些所需的设置(别名)。
但是,需要配置 Aquamacs 以使“~/.bash_profile”在每个 Aquamacs 会话中执行一次,而“~/.bashrc”在每个 Aquamacs shell 中执行一次?否则,例如从 '~/.emacs_bash' 到 '~/.bash_profile' 的链接,连接的 shell 变量(通常是 $PATH)会在其中获得很多冗余值。
在 NT 上的 *nix 和 Cygwin 上,GNU Emacs 以预期的方式使用 '.bash_profile' 和 '.bashrc' 开箱即用:'.bash_profile' 在 *nix 系统和所有 shell 上执行一次,包括 Emacs shell缓冲区,从中获取变量。同样,'.bashrc' 每个 *nix shell 执行一次,包括 Emacs shell 缓冲区。
有没有人对如何让 Aquamacs 做同样的事情有任何指示?