开发者

define bash aliases for Aquamacs shell

for Emacs you can define your shell-mode aliases in .emacs.d/init开发者_运维问答_bash.sh, but Aquamacs (2.0 on OS X 10.5) does not seem to use this. Is there another place where these can be defined?


From shell.el:

If a file ~/.emacs_SHELLNAME' exists, or~/.emacs.d/init_SHELLNAME.sh', it is given as initial input (but this may be lost, due to a timing error, if the shell discards input when it starts up). The buffer is put in Shell mode, giving commands for sending input and controlling the subjobs of the shell. See shell-mode'. See also the variableshell-prompt-pattern'.

So you might want to try seeing whether ~/.emacs_bash works.


Solved for me: I made two changes that seem to do the trick (I had earlier done Aquamacs -> Tools -> Install Command Line Tools). The changes were: a) Remove the '~/.emacs_bash' symlink I'd created; b) Create a '~/.bashrc' file containing an invocation of my alias-setting script; c) Invoke '~/.bashrc' from '~/.bash_profile' (leaving exported env vars in ~/'.bash_profile' where they belong).

Aquamacs seems to append '/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin' to the path it gets from '~/.bash_profile', but that doesn't seem to be a problem.

      • My previous answer and question:

A symlink from '~/.emacs_bash' to '~/.bash_profile' succeeded in getting '~/.bash_profile' to execute on Aquamacs, so that the shell buffers have some of the desired settings (aliases).

However, what is needed is to configure Aquamacs so that '~/.bash_profile' executes once per Aquamacs session, and '~/.bashrc' executes once per Aquamacs shell? Otherwise, for example with a link from '~/.emacs_bash' to '~/.bash_profile', concatenated shell variables (commonly, $PATH) get a lot of redundant values in them.

On *nix and Cygwin on NT, GNU Emacs works out of the box with '.bash_profile' and '.bashrc' in the expected way: '.bash_profile' is executed once on the *nix system, and all shells, including Emacs shell buffers, get the variables from that. Likewise, '.bashrc' executes once per *nix shell, including for Emacs shell buffers.

Does anyone have any pointers to how to get Aquamacs to do the same?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜