Someone use that technique to hook a WSL bash shell in there. I can't wait for notepad to be my terminal.
(defun sh-line ()
(interactive)
(let ((cmd (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
(end-of-line)
(newline)
(insert (shell-command-to-string cmd))))
(local-set-key (kbd "M-RET") 'sh-line)
With this Alt-RET will evaluate the last line in your shell, and insert the output.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.