简体   繁体   中英

MSYS2 inferior shell in Emacs on Windows

Trying to launch an inferior shell (Mx shell) in Emacs on Windows that connects to MSYS2.

I found this snippet from Mastering Emacs - Running Shells in Emacs Mastering Emacs, and adapted it:

(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)

I get the following:

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
]0;~
me@computer MSYS ~
$ 

So I have some extra goofy characters and an inappropriate command passed to the MSYS shell, but this is progress. MSYS2 + Emacs on Windows would be AMAZING.

The problem is -i for Bash. It means interactive, so Bash attempts to configure terminal with ioctl which is nonsense for native Windows Emacs. Strip -i in native Emacs when you are using MSYS2 Bash.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM