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. The following is how I did it:
- Create a Windows environment variable named ‘CYGWIN’ with the value ‘tty’
- Install Cygwin
- Install Cygwin/X
- Download-and-install Emacs using the setup.exe (as explained in the documentation linked above), choose the packages ’emacs’ and ’emacs-X11′, and be sure to check the “Bin?” checkbox. If you don’t check “Bin?” it will look like the installer is doing something, but in reality it does nothing (guess how I know that?).
- Add this to your .bashrc (see steps below if you want to use Emacs): export DISPLAY=:0.0
- Run: source .bashrc
- Run: XWin -multiwindow &
- Run: xeyes &
- Xeyes should pop up. Now try emacs
- Run: emacs &
- The Emacs welcome screen should appear.
Updating your .bashrc
- Open a terminal
- Type: emacs -nw .bashrc
- Emacs gives you a welcome message. Hit C-l to continue editing.
- Go to the bottom of the page
- Insert an empty line at the end and type in the text listed above
- Hit C-x C-s to save the file
- Hit C-x C-c to exit Emacs
I removed the unnecessarily complex step re-starting the shell when source’ing would have done just fine.
I wasn’t happy with my explanation for doing this, so I revised it.
13 thoughts on “GNU Emacs on Cygwin”
6. Close this terminal and open a new one
What you want to do is re-read your bashrc file I assume? You can also do that with ‘source .bashrc’ from the prompt.
I do run emacs on bare windows though, I like having the context menu ‘Edit in Emacs’ and things like that. Although I also have cygwin installed, so I might have to give this a try.
Re #6, why did I assume the reader wouldn’t want to type that?! Thanks for the nudge.
Parts 5 and onwards. Could you maybe explain it a little more?
Why when I write “XWin -multiwindow &” does the window say “& bash: XWin: command not found”?
The “command not found” thing is the shell’s way of telling you that it can not find XWin.exe. For example:
bash: foo: command not found
In step #3 above, XWin.exe should have been installed (along with a number of other things to support X).
Hello . I need to install emacs as well as cygwin because i dont want to change windows into linux . I really need emacs on my laptop because i need to study for a lesson of my course . I’m not an expert in fortran language and after the fifth instruction i dont understand a thing . Please help ASAP
Konstantina what problem are you running into?
well first of all i cant find the link you are suggesting to download Emacs . I decided to search and download it myself . I have no idea what i should do next . By the way i opened emacs and it works properly but i cant compile because my terminal cygwin is not connected to emacs . I just want an exact description on what i should do and what i should type on terminal
oh and thanks for the immediate response !
so sorry for the previews comments . I figured it out . It would be useful though if you could attach a link for me to download emacs . Kind regards
“Create a Windows environment variable named ‘CYGWIN’ with the value ‘tty’”
What does this do, and why is it necessary?
I do not remember. Looking back I can’t remember either and the links don’t explain it.
At best I found the solution EmacsWiki in the references.