Skip to content

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. The following is how I did it:

Steps

  1. Create a Windows environment variable named ‘CYGWIN’ with the value ‘tty’
  2. Install Cygwin
  3. Install Cygwin/X
  4. 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?).
  5. Add this to your .bashrc (see steps below if you want to use Emacs): export DISPLAY=:0.0
  6. Run: source .bashrc
  7. Run: XWin -multiwindow &
  8. Run: xeyes &
  9. Xeyes should pop up. Now try emacs
  10. Run: emacs &
  11. The Emacs welcome screen should appear.

Updating your .bashrc

  1. Open a terminal
  2. Type: emacs -nw .bashrc
  3. Emacs gives you a welcome message. Hit C-l to continue editing.
  4. Go to the bottom of the page
  5. Insert an empty line at the end and type in the text listed above
  6. Hit C-x C-s to save the file
  7. Hit C-x C-c to exit Emacs

References

Addendum: 16/10/08

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.

4 Comments

  1. Geoff wrote:

    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.

    Thursday, October 16, 2008 at 20:57 | Permalink
  2. Grant wrote:

    Re #6, why did I assume the reader wouldn’t want to type that?! Thanks for the nudge.

    Thursday, October 16, 2008 at 22:47 | Permalink
  3. Ben wrote:

    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”?

    Wednesday, September 22, 2010 at 06:17 | Permalink
  4. Grant wrote:

    Ben:

    The “command not found” thing is the shell’s way of telling you that it can not find XWin.exe. For example:

    rettkeg@RETGRA-34-00-09:~>foo
    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).

    Wednesday, September 22, 2010 at 08:31 | Permalink

One Trackback/Pingback

  1. [...] Installing Emacs on Cygwin [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*