cygwin shell in emacs /cmd.exe in windows - windows

I am attempting to get python to run in a command shell in emacs. I have tried the standard M-x shell that comes with windows emacs and then type 'python' but python just hangs up (no output). I have also tried running other program shells such as bash.exe from cygwin with the same result. Any way to get a shell that can run other programs like python?

Why not use M-x python-shell? This provides an interactive REPL for Python within Emacs.

Related

How would I interface with the Linux terminal (bash for windows) using windows command prompt?

I just recently found out about using bash in windows. I had alot of fun installing linux programs onto my windows computer using bash and wondered how I would be able to run an automatic script so I dont have to export my display everytime I open bash.
I used to write scripts for cmd called batch scripting and I would be able to do everything cmd could do. Now that I have access to bash, I want to script a program that connects useful pieces of cmd with useful pieces of bash but I Can't find any results telling me how to call bash commands from cmd. Thank you - Zak Kaioken

How can I run Windows 10's bash for Emacs mingw32 for Windows?

I would like to use the recent bash shell of Windows 10 in shell mode of Emacs (mingw32) for Windows. Could anyone advise how could I do that?
You can use one of the other terminal mode: term or ansi-term by typing M-x term or M-x ansi-term.
When being invoked, these terminals will ask for the path to your shell. Here you just need to put the correct path to the Windows shell.

On W32 Emacs why does Ctrl-D in Cygwin or MinGW bash issues repeated EOFs?

I'm using W32 GNU Emacs 24.1.50.1 with Cygwin bash 3.2.51. I know that this combination is very troublesome (see EmacsWiki and Cygwin list). However the problem I want to solve now is not confined to Cygwin. I got the issue with MinGW as well. So, the problem is:
In Emacs start a shell via M-x shell provided you have set up the variables shell-file-name and explicit-bash-args appropriately (see e.g. here). Then issue a command which expects stdin input, e.g. cat. To cancel out of cat you can usually type Ctrl-D once and you return to the shell prompt. In W32 emacs when you do this (or even when you issue explicitly M-x comint-send-eof) the cat command gets exited and the bash shell quits as well.
I tried to increases bash's "resilience' by setting the environment variable IGNOREEOF to, say, 5, but then a single Ctrl-D results in the following output
$ Use "exit" to leave the shell.
$ Use "exit" to leave the shell.
$ Use "exit" to leave the shell.
$ Use "exit" to leave the shell.
$ Use "exit" to leave the shell.
$ exit
Process shell finished
and, of course, the bash has exited again. This problem only happens when the shell runs in W32 emacs - Cygwin bash through the Cygwin tty window and MinGW bash through its own MinTTY work fine.
Why is this happening in W32 Emacs and how can I just exit the running subcommand (e.g. cat) when using W32 Emacs without exiting the bash shell?
The notion of tty like you expect it to behave doesn't really exist in the W32 worl. If you want to see this Unixy behavior, you need not only to run a Cygwin program but that Cygwin program needs to talk to another Cygwin program (Emacs, terminal, you name it). IOW you'll only get that with the Cygwin version of Emacs.
The GNU Emacs FAQ for MS Windows notes that this issue exists for any sub-process in the shell buffer. So it affects the DOS command line as well (but of course you don't usually use Ctrl-D in DOS, so it's not so noticeable). No workaround is suggested in the FAQ, so I'm guessing that there's no easy fix.
Usually you can use Ctrl-Z as well as Ctrl-D. Take a look at this note:
http://ignaciopp.wordpress.com/2009/07/02/emacs-shell-workaround-for-killing-input-in-windows-version/

sbt: Can't run interactively from mintty on cygwin

When I run sbt interactively from a DOS shell or from a cygwin bash terminal, it functions just fine. However, when I try to run from my preferred mintty terminal, sbt doesn't respond to my commands until I send it an end of file (control-) and sbt exits.
TERM is set to cygwin when I'm using the bash terminal, and it's xterm when I'm using mintty.
Does anyone know how to fix this?
It ends up that by doing the opposite of this answer, I added the -Djline.terminal=jline.UnixTerminal java option to my sbt startup script to fix the problem.

Shell commands from vim

What is the best approach of using shell commands from vim? I know about the possibility of !shell_command. But this doesn't know all commands e.g.
export OSTYPE; make install So I have to run it outside vim. Is there better approach?
I know this is a bit late, but my preferred approach is suspending the vim process (Ctrl+z). You return to your shell/bash command prompt.
Then execute whatever command(s) you like.
Return to vim by typing fg
You can start a shell from Vim using the :sh command. When the shell exits
(after the exit command or Ctrl+D) you return to Vim. The name for the shell command comes from the shell option.
For terminal Vim (on unix-like systems) you can also use Ctrl+Z to suspend Vim and get back to the shell from which it was run. To resume the Vim process, use the fg command.

Resources