windows - 更改 Emacs M-x shell 以使用 Windows 10 bash

标签 windows bash emacs windows-subsystem-for-linux

我使用 Windows 图形化 Emacs 有一段时间了,我正尝试将它与 Windows 10 的新 Windows Bash 一起使用。我想要做的是,当我输入 Windows Emacs M-x shell 时,我希望它使用 Windows Bash shell,而不是普通的 Windows cmd。我尝试将其添加到我的 .emacs 文件中:

(setq explicit-shell-file-name "C:/path/to/bash.exe")
(setq shell-file-name "bash")
(setq explicit-bash.exe-args '("--noediting" "--login" "-i"))
(setenv "SHELL" shell-file-name)
(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)

我从 here 得到的.这一点,当我运行 M-x shell 时,出现了 Spawning child process: invalid argument 错误。我试着省略第三行,因为它是关于争论的,但那没有任何作用。有没有办法做到这一点?提前致谢。

最佳答案

所以这个 defun 对我来说可以启动 WSL bash shell。

(defun run-win-ubuntu () (交互的) (let ((shell-file-name "C:\\Windows\\System32\\bash.exe")) (外壳“*ubuntu*”)) )

关于windows - 更改 Emacs M-x shell 以使用 Windows 10 bash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40432242/

相关文章:

c# - 找不到 System.Windows.Point

xml - 在 IIS 服务器 web.config 文件中放置 <httpProtocol> 的位置

python - 当 Python 脚本运行并以 sys.exit(0) 结束时出现错误 : exited with status 2

emacs - Elisp:在交互式命令中询问是或否

c++ - 相同的正则表达式,但在 Linux 和 Windows 上结果不同(仅限 C++)

c# - 我如何开始编写 Windows Shell 扩展?

Bash 函数从 POSIX PATH 中删除重复项

linux - 在 Linux 上删除除 .git 目录和 .gitignore 之外的所有内容

emacs - emacs中window之间的高效切换

emacs - 如何测试org-narrow-to-subtree是否生效