Emacs编译模式不会看到bash别名 [英] Emacs compilation mode won't see bash alias

查看:89
本文介绍了Emacs编译模式不会看到bash别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Emacs M-x编译看不到.bashrc中设置的任何别名.如果我使用M-x shell,则键入别名就可以了.我尝试从/etc/profile、~/.profile、~/bash_env采购.bashrc,但我认为没有任何帮助.

Emacs M-x compile does not see any aliases set in .bashrc. If I use M-x shell then type the alias, it is fine. I tried sourcing .bashrc from /etc/profile, from ~/.profile, ~/bash_env, anything I can think of to no avail.

我使用的是Emacs 23和Ubuntu11.我从桌面按钮使用/usr/bin/emacs%F启动emacs.

I am on Emacs 23 and Ubuntu 11. I start emacs using /usr/bin/emacs %F, from a desktop button.

推荐答案

Emacs从父进程继承其环境.您如何通过命令行或其他方式调用Emacs?

Emacs inherits its environment from the parent process. How are you invoking Emacs - from the command line, or some other way?

如果您发生了什么事情

Mx 编译 RET Ca Ck bash -i -c 您的别名 RET

M-x compile RET C-a C-k bash -i -c your_alias RET

将bash作为交互式外壳程序(-i选项)应读取您的.bashrc别名.

Invoking bash as an interactive shell (-i option) should read your .bashrc aliases.

我认为 M-x shell命令和 M-x 都通过调用进程在下级shell中编译执行命令.在.emacs中尝试以下操作(或只是进行评估):

I think both M-x shell-command and M-x compile execute commands in an inferior shell via call-process. Try the following in your .emacs (or just evaluate):

(setq shell-file-name "bash")
(setq shell-command-switch "-ic")

我注意到,经过上述评估,.bashrc别名被 M-x shell命令和 M-x 编译使用,即

I notice that after evaluation of the above, .bashrc aliases are picked up for use by both M-x shell-command and M-x compile, i.e

M-x 编译 RET 您的别名 RET

然后应该工作.

我的环境:Emacs 24.1(预测试rc1),OSX 10.7.3

My environment: Emacs 24.1 (pretest rc1), OSX 10.7.3

这篇关于Emacs编译模式不会看到bash别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆