我在 Windows 上运行 GNU Emacs,因此输入:
M-x shell
启动 Windows 命令行 DOS shell。但是,我希望能够从 Emacs 中运行 Cygwin Bash Shell(或任何其他非 Windows shell)。这怎么能轻易做到呢?
shell-file-name
是控制 Emacs 在要运行 shell 命令时使用哪个 shell 的变量。
explicit-shell-file-name
是控制哪个 shell 的变量M-x shell
启动。
肯的回答 https://stackoverflow.com/questions/235254/how-can-i-run-cygwin-bash-shell-from-within-emacs#235344改变这两个,你可能想要也可能不想要。
您还可以通过临时更改来启动不同的 shell 的功能explicit-shell-file-name
:
(defun cygwin-shell ()
"Run cygwin bash in shell mode."
(interactive)
(let ((explicit-shell-file-name "C:/cygwin/bin/bash"))
(call-interactively 'shell)))
您可能还想通过--login
bash 的参数,因为您正在开始一个新的 Cygwin 会话。您可以通过设置来做到这一点explicit-bash-args
。 (注意M-x shell
uses explicit-
PROGRAM-args
,其中 PROGRAM 是 shell 路径名的文件名部分。这就是为什么你不应该包括.exe
设置外壳时。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)