cygwin bash does not display correctly in emacs shell
emacs shell vs term
emacs shell previous command
emacs terminal command
emacs better shell
emacs shell command-on buffer
emacs shell script mode
emacs eshell navigation
I'm trying cygwin with emacs. My environment is Windows 7 x64, emacs-184.108.40.206, cygwin 2.769, system encoding is gbk, cygwin's coding system is default to utf-8, and emacs's coding system is default to gbk
I use setup-cygwin to setup cygwin with emacs. And I can launch emacs shell using cygwin bash.But I encountered two problem. First, two warnings at the beginning of bash
bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell
Second, after bash response, some strange characters appeared.
Does anyone know what happened?
A "known problem," with no known solution (yet):
Running Shells in Emacs: An Overview, Bash (or another shell) says "command not found", but it's right there! Is there a Cygwin port of GNU Emacs? Why isn't timezone set correctly? If you have inetd configured to run as a standalone service, it will not show up in the list, but Problems with Bash Shell. First problem is Cygwin Bash shell does not recognize a DOS batch file byits .bat extension. Thus, typing autoexec in a Bash Shell will not invokeautoexec.bat. The solution is to type the entire file name including the.bat extension.
Add this to your init:
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
As for your other message, I've started getting that myself only recently. I've run emacs/cygwin/bash for a while, and I'm not sure yet what caused it.
Cygwin FAQ, After cygwin has been installed, a bash shell program can be invoked by double Please take note that both Emacs and Cygwin use the same HOME environment variable. Chinese characters can be displayed correctly. First problem is Cygwin Bash shell does not recognize a DOS batch file by its .bat extension. Thus When the "clear" command is entered into the bash shell, it is expected to clear the entire shell buffer. However, this does not work for bash shell under Gnu Emacs. The following lisp statements solve the problem. Notice that the following statements also intercepts the "man" command entered by the user and execute it outside the shell.
If nothing else works, you can customise your shell prompt for the case when you are running
M-x shell by making use of the following functionality:
(info "(emacs) Interactive Shell") RET
Emacs sends the new shell the contents of the file
~/.emacs_SHELLNAME' as input, if it exists, where SHELLNAME is the name of the file that the shell was loaded from. For example, if you use bash, the file sent to it is~/.emacs_bash'. If this file is not found, Emacs tries with `~/.emacs.d/init_SHELLNAME.sh'.
So you can specify a prompt without colour codes in that file (i.e. set the
PS1 environment variable).
Cygwin Bash Shell, There are two ports of Emacs you can run together with Cygwin. Choose emacs-X11 to run both the X and terminal (character-mode) versions, or emacs to run normal 7-bit ASCII chars, just ones that don't belong in the current buffer) are often visible in the new one. Setting the window size “properly. GNU Emacs on Cygwin While it is possible to run Emacs on Windows, I suspect that Emacs “expects” to be running on UNIX. As such, I’ve decided to perform an experiment and try to do most of my work in Cygwin, including running Emacs.
Regarding the strange characters, I realised that I had this piece of code messing around:
; Always prefer UTF-8 encoding ;(prefer-coding-system 'utf-8-with-signature-dos)
And this was causing most commands to fail, because it was adding the BOM (
ï»¿) to the command invokation:
---------------------------------------------------------- -*- mode: grep; default-directory: "~/" -*- Grep started at Sat Oct 06 02:53:32 grep -nH -e test 'ï»¿grep' is not recognized as an internal or external command, operable program or batch file.
Cygwinized Emacs HOWTO, support and the Meta key doesn't work properly (see CygwinMeta). Actually the third point is not strictly true, depending on what you mean by “Win32 console”. cygwin support ;;;; ;; Sets your shell to use cygwin's bash, if Emacs finds This removes unsightly ^M characters that would otherwise ;; appear 7.7 How do I use a shell in Emacs? You can start an interactive shell in Emacs by typing M-x shell. By default, this will start the standard Windows shell cmd.exe. Emacs uses the SHELL environment variable to determine which program to use as the shell. To instruct Emacs to use a non-default shell, you can either set this environment variable
start a new terminal (bash) with
strace -o bash.log bash could help debugging this problem.
What it looks like is that some device that bash tries to open is missing appropriate permissions or doesn't even exist.
grep your bash.log file for any /dev strings and check if there is any issues there. For example my bash opens up /dev/tty:
$ grep "/dev" bash.log open("/dev/tty", O_RDWR|O_NONBLOCK) = 3
NTEmacs With Cygwin, display · create-fontset-from-fontset-spec : Non-latin display · cua-mode : CUA · exec-path : Cygwin · explicit-bash-args : Shell echo · explicit-bash.exe-args Cygwin developers recommend that you do not put Cygwin on your system PATH for this reason. Instead you can make the Cygwin tools available within Emacs by setting exec-path in your init file.
Indexes - GNU Emacs FAQ For MS Windows, 1) Emacs most likely starts in console mode because no DISPLAY variable is set; set What you can do instead is use the Cygwin run command, which launches a with Emacs on that machine; assuming your X server is properly configured, the batch file and the shell script, e.g. "%1" in the former and "$1" in the latter. When using precompiled NTemacs version GNU Emacs 23.4.1 (i386-mingw-nt6.1.7601) with a Cygwin installation with Cygwin1.dll version 1.7.11-1, you have trouble running bash in emacs. On `M-x shell` you get: bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell
How do I open a file in Cygwin Emacs from Windows?, If this file is not found, Emacs tries to fallback on ~/.emacs.d/init_shellname.sh. How can I run Cygwin Bash Shell from within Emacs? C:\temp>bash bash However, no command prompt is visible which can be disorienting that can make certain commands (like M-x grep-find) not work correctly, so it is important you put The Cygwin DLL currently works with all recent, commercially released x86_64 versions of Windows, starting with Windows Vista. For more information see the FAQ . The most recent version of the Cygwin DLL is 3.1.2 . Installing Cygwin. Install Cygwin by running setup-x86_64.exe. Use the setup program to perform a fresh install or to update an
cygwin shell in Emacs - output messed up? - emacs - iOS, so this is to use the cygwin bash shell in emacs shell-mode. Though I see no mention of Windows 7 on the supported list, only Vista. Cygwin emacs (in a terminal) so I can use grep etc etc correctly. level 1 explain-pause uses the built in profiler package to generate CPU sample profiles, which [ View profile ] displays.). When in Cygwin terminal I run $ emacs -nw emacs: standard input is not a tty How can I make emacs run inside the Stack Exchange Network Stack Exchange network consists of 175 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
- I can confirm this problem exists with Emacs 23.2.1 as well, not just 23.4.1. The real workaround is not to upgrade Cygwin and instead stick with an older version. Which begs the question: Why is this issue labeled "NTEmacs breaks cygwin bash"? (i.e. should be "cygwin bash breaks NTEmacs").
- The problem still exists with Cygwin 2.8.1 and Emacs 24.5.1. The Gmane link in the answer does not work. I think this is the mailing list message: sourceware.org/ml/cygwin/2012-03/msg00347.html.
- Hey, man, it does not works for me... Anyway, thanks for your hint
- @MartinLuo, just to be sure, you need to restart emacs of course.
- Yes, i restart it indeed, but it remains the same way
- No idea if your suggestion will help me solve the problem but since you are the only one answering this question after I opened a bounty, you get it. :) I will report back as soon as I have a chance to implement your solution.
- I don't know whether this answer could help me. But I will try it later when I use Windows, I use Mac most of the time. :) Thanks for your answer!