当我运行shell命令时,有没有办法让我的emacs识别我的bash别名和自定义函数? [英] Is there a way to get my emacs to recognize my bash aliases and custom functions when I run a shell command?
问题描述
以下是我对我的看法是一个相关的问题:
我认为 Mx shell命令和 Mx 通过调用进程在下面的shell中编译执行命令。尝试以下的.emacs(或只是评估):
(setq shell-file-名称bash)
(setq shell-command-switch-ic)
我注意到,在评估上述之后,.bashrc别名被选择以供 Mx shell命令和 Mx 编译使用,即
Mx 编译 RET your_alias RET
我的环境:Emacs 24.1(pretest rc1),OSX 10.7.3
In my shell environment I have aliases and custom functions. When I am in an instance of emacs (I always use emacs -nw) and I execute a shell command (M-x !) I cannot use them. This makes sense since I imagine it launches it's own subshell to do these..but is there a way (maybe in my .emacs) to get this to work? Perhaps even if it involved sourcing an environment by default before executing any shell command given?
Below are my comments about what I think was a related question:
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
这篇关于当我运行shell命令时,有没有办法让我的emacs识别我的bash别名和自定义函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!