在Windows上的Emacs中使用MSYS2劣质shell

5

想在Windows上使用Emacs启动一个连接到MSYS2的inferior shell (M-x shell)。

我从Mastering Emacs - Running Shells in Emacs中找到了以下片段,并进行了调整:

(setq explicit-shell-file-name "D:/msys64/usr/bin/bash.exe")
(setq shell-file-name "bash")
(setq explicit-bash.exe-args '("--login" "-i")) <- Have also tried -c, and without "--login"
(setenv "SHELL" shell-file-name)
(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)

我得到了以下结果:
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
]0;~
me@computer MSYS ~
$ 

所以我在MSYS shell中输入了一些额外的傻瓜字符和不适当的命令,但这是进步!在Windows上使用MSYS2和Emacs将会非常棒。


1
你说一个“劣质”的shell?你一定是在找csh(pax躲避)。 - paxdiablo
1
你确定 D:/msys64/mingw64/bin/bash.exe 是正确的路径吗?我认为找不到可执行文件是你看到的错误最有可能的原因。 - D Krueger
@DKrueger 你说得对!我现在已经让Emacs通过MSYS进行通信了,但还不是很“干净”。它在D:/msys64/usr/bin中。在这件事上感觉有点傻。 - trayres
1个回答

1
问题出在Bash的-i上。它表示交互式,因此Bash试图使用ioctl配置终端,这对于本机Windows Emacs来说是无意义的。在使用MSYS2 Bash时,请在本机Emacs中去掉-i

1
五年后。这就是为什么Emacs最终会战胜所有其他编辑器的原因。 - trayres
似乎我们需要忍受由 -i 触发的错误消息,因为该选项负责激活交互模式:从而加载 ~/.bashrc - gavenkoa

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