为Aquamacs shell定义bash别名

时间:2010-08-16 10:24:49

标签: macos emacs aquamacs

对于Emacs,你可以在.emacs.d / init_bash.sh中定义你的shell模式别名,但是Aquamacs(OS X 10.5上的2.0)似乎没有使用它。还有另一个地方可以定义这些吗?

2 个答案:

答案 0 :(得分:1)

来自shell.el:

  

如果是文件~/.emacs_SHELLNAME' exists, or〜/ .emacs.d / init_SHELLNAME.sh',那么   作为初始输入给出(但是这个   如果,由于时间错误,可能会丢失   shell会丢弃输入   启动)。缓冲区放在Shell中   模式,发出命令   输入和控制的子工作   贝壳。请参阅shell-mode'. See also the variable shell-prompt-pattern'。

所以你可能想看看〜/ .emacs_bash 是否有效。

答案 1 :(得分:1)

为我解决:我做了两个似乎可以解决的变化(我之前做过Aquamacs - >工具 - >安装命令行工具)。变化是:a)删除我创建的'〜/ .emacs_bash'符号链接; b)创建一个'〜/ .bashrc'文件,其中包含我的别名设置脚本的调用; c)从'〜/ .bash_profile'调用'〜/ .bashrc'(将导出的env变量保留在它们所属的〜/'。bash_profile'中。)

Aquamacs似乎将'/ usr / bin:/ bin:/ usr / sbin:/ sbin:/ usr / texbin'附加到从'〜/ .bash_profile'获取的路径,但这似乎不是一个问题。

      • 我以前的回答和问题:

从'〜/ .emacs_bash'到'〜/ .bash_profile'的符号链接成功地让'〜/ .bash_profile'在Aquamacs上执行,以便shell缓冲区具有一些所需的设置(别名)。

然而,需要配置Aquamacs以便每个Aquamacs会话执行一次'〜/ .bash_profile',并且每个Aquamacs shell执行一次'〜/ .bashrc'?否则,例如使用从'〜/ .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做同样的事情?