Is there a way to get my emacs to recognize my bash aliases and custom functions when I run a shell command?

前端 未结 5 1335
南笙
南笙 2020-12-02 20:30

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-!

5条回答
  •  半阙折子戏
    2020-12-02 21:09

    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

    Source

提交回复
热议问题