Emacs的编译模式不会看到bash别名 [英] Emacs compilation mode wont see bash alias

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

问题描述

Emacs M-x编译没有看到.bashrc中设置的任何别名。如果我使用M-x shell然后键入别名,这是很好的。我尝试从/ etc / profile中的〜/ .profile,〜/ bash_env采购.bashrc,我可以想到的任何事情都无济于事。



我在Emacs 23和Ubuntu 11.我从桌面按钮启动emacs使用/ usr / bin / emacs%F。



任何想法?

解决方案

Emacs从父进程继承其环境。你如何调用Emacs - 从命令行还是其他方式?



如果你有以下情况,你会发生什么:



Mx 编译 RET Ca Ck bash -i -c your_alias 调用bash作为交互式shell(-i选项)应该读取.bashrc别名。



编辑:我认为shell命令和 Mx 中的编译通过调用进程在下面的shell中执行命令。尝试以下的.emacs(或只是评估):

 (setq shell-file-名称bash)
(setq shell-command-switch-ic)

我注意到,在评估上述之后,.bashrc别名被选择以供 Mx shell命令和 Mx 编译使用,即



Mx 编译 RET your_alias RET



$ p

我的环境:Emacs 24.1(pretest rc1),OSX 10.7.3


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.

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

Any ideas?

解决方案

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

What happens if you:

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

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

Edit: 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")

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 compile RET your_alias RET

should then work.

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

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

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