如何为emacs定义默认shell

6

我的默认 shell 是 fish,我不想改变它。但是在 Emacs 中,Tramp 与 fish 配合使用效果不佳。因此,我只想将 bash 设置为 Emacs 的默认 shell。这是否可能?


1
我建议将此问题标记为离题,并建议迁移到https://emacs.stackexchange.com/。 - tripleee
2个回答

11

shell函数的文档中获取的信息(C-h f shell RET):

Program used comes from variable `explicit-shell-file-name',
 or (if that is nil) from the ESHELL environment variable,
 or (if that is nil) from `shell-file-name'.

如果你想在emacs缓冲区中使用“/bin/bash”作为shell文件,你可以采取以下任一方式:

  • 在你的~/.emacs文件中设置变量'explicit-shell-file-name':

    (setq-default explicit-shell-file-name "/bin/bash")

  • 在你的~/.profile文件中设置ESHELL环境变量:

    export ESHELL=/bin/bash

  • 在你的~/.emacs文件中设置变量'shell-file-name':

    (setq-default shell-file-name "/bin/bash")


2

《流浪汉手册》提到了与鱼有关的问题。也许你可以尝试其中提出的建议:

Similar fancy prompt settings are known from the fish shell.
Here you must add in ‘~/.config/fish/config.fish’:

     function fish_prompt
       if test $TERM = "dumb"
          echo "\$ "
       else
          …
       end
     end

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接