trayres
trayres

Reputation: 532

MSYS2 inferior shell in Emacs on Windows

Trying to launch an inferior shell (M-x 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.

Upvotes: 6

Views: 2692

Answers (1)

gavenkoa
gavenkoa

Reputation: 48893

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.

Upvotes: 2

Related Questions