2010-09-23

Emacs on Windows 7, and setting up ColorTheme

Wanting Emacs on Windows 7?  The install is easy.  There is nice but old instructions over at Installing Emacs on Windows 95/98/2K/NT/ME/XP/Vista/Windows 7.  Here's what I did (I used an administrator account.  YMMV).
  1. I wanted emacs in C:\Program Files (x86)\emacs, so I created that folder first
  2. Go here to get the latest emacs version. I got emacs-23.2-bin-i386.zip
  3. Unzip that file and dump its contents into C:\Program Files (x86)\emacs
  4. In Windows Explorer, open C:\Program Files (x86)\emacs\bin, then double click on runemacs.exe
  5. Yay! You have emacs running.  You may wish to add runemacs.exe to your Start menu (drag and drop it there)
Now I copied over from my Ubuntu Linux my .emacs and .emacs.d.  But where to place it?  If you follow Art Lee's instruction step 6, you can control where you want to place those files using the HOME Environment Variable (set in the Windows Control Panel).

On the other hand, why bother?  Especially if you are not running emacs as an administrator.  By default, the HOME will apparently be set as C:\Users\your_user_name\AppData\Roaming anyway, so copy .emacs and .emacs.d into that directory.

Unfortunately for me, coming from Ubuntu, I had ColorTheme installed via apt-get, so it wasn't contained in my .emacs.d.  I have to reinstall that now...

  1. Create this folder C:\Users\your_user_name\AppData\Roaming\.emacs.d\color-theme-6.6.0 (change or remove the version number as you like)
  2. Go to color-theme homepage and get the latest.  I got color-theme-6.6.0.zip
  3. Unzip and dump the file color-theme.el and the folder themes into the folder you created in step 1
  4. As per the references for ColorTheme and emacs Load Path, add the following to your .emacs (you may have to strip out any previous color theme settings yourself):

(let ((default-directory "~/.emacs.d/color-theme-6.6.0/"))
(normal-top-level-add-to-load-path '("."))
(normal-top-level-add-subdirs-to-load-path))

(require 'color-theme)
(color-theme-initialize)
(color-theme-pok-wob) ;; "White on Black" theme

Quick note about the theme setting.  I used to have:

(custom-set-variables '(color-theme-selection "White On Black" nil (color-theme)))

But that doesn't work for whatever reason.  To find the correct function name to set the theme, fire up emacs, do M-x color-theme-select, scroll the cursor down to the theme you want and press d.

I'm not sure if this works or not with the ColorTheme as installed via apt-get'ing emacs-goodies-el in Ubuntu, but it worked for me in Windows 7.

3 comments:

Anonymous said...

Thanks dude, this really helped me.
Thanks for sharing. I was lacking a proper emacs in Windows 7.

Shifttusk said...

Hey, this indirectly helped me just get emacs up and running properly in win7. Never had set the HOME variable and my system kept on deleting my .emacs.

In business now thanks alot!

zaforitos said...

thanks alot