Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run emacs in CLI mode under mintty in windows?

I'm using mintty + msys. And I want to use emacs with it. But without GUI.
I saw such behavior in cygwin. But I can not understand how they did that.

$ emacs -nw
  emacs: standard input is not a tty

$ stty.exe -a
  speed 38400 baud; rows 24; columns 80; line = 0;
  intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>;
  eol2 = <undef>; swtch = ^Z; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
  werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
  -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
  -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
  -iuclc ixany imaxbel
  opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
  isig icanon iexten echo echoe echok -echonl -noflsh -tostop echoctl echoke

$ echo $TERM
  xterm
like image 360
denys Avatar asked Jan 22 '13 18:01

denys


People also ask

What is Mintty shell?

Mintty is a terminal emulator for Cygwin with a native Windows user interface and minimalist design. Its terminal emulation is largely compatible with xterm, but it does not require an X server.


2 Answers

You should use winpty:

winpty emacs -nw

winpty is a Windows software package providing an interface similar to a Unix pty-master for communicating with Windows console programs. The package consists of a library (libwinpty) and a tool for Cygwin and MSYS for running Windows console programs in a Cygwin/MSYS pty.

Emacs in your case is actually "Windows console program".

like image 162
Evgeny Panasyuk Avatar answered Oct 05 '22 16:10

Evgeny Panasyuk


If you want to use tty emacs with mintty, you will probably need to use cygwin's emacs. The native win32 emacs wants to talk to a Windows console window, not to an actual tty -- the error message is misleading here.

Another alternative, if you want to stick with the native win32 emacs, is to use ConEmu, rather than mintty. It gives a compatible Windows console interface while also providing all the niceties of a normal terminal emulator like mintty.

like image 36
JFM Avatar answered Oct 05 '22 17:10

JFM