Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Speaking of Emacs, shells and WSL, I recently had to shell out from Emacs under WSL to git-bash under Windows proper, to run cmake to run MSBuild, and get the generation/compilation output all the way back. Turns out, while regular M-x shell-command would work, M-x async-shell-command (i.e. shell-command with appended &) would not - it wasn't able to communicate with the spawned process. I needed it to be async so that a compile wouldn't block my Emacs.

The solution I came up with is a bit lower-level, looks like this:

  (make-process :name "some_name"
                :buffer "buffer"
                :command ("cmd" "to" "run")
                :connection-type 'pipe
                :coding 'utf-8-dos)
Two key lines are :connection-type 'pipe, which solves the I/O issues, and :coding 'utf-8-dos, which ensures the output streamed to an Emacs buffer isn't polluted by ^M (CR from CRLF line ending).

Now, if anyone figured out how to configure a connection to a language server across the WSL boundary, I'm all ears.



Does `M-x compile` not work for you on windows? This is what I use to do run build scripts async.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: