Customizing Emacs for CS 151

Linux or Unix

  1. If your version of Emacs does not come with Python mode already, create a directory called emacs in your home directory and save the file python-mode.el in this directory.

  2. Add this code to the .emacs initialization file in your home directory (if you don't have a .emacs file, you'll need to create one first).

  3. If you need the Python interpreter itself, download either Python-2.4.1.tgz or one of the available RPM files. See this page for more detailed instructions. With Python installed, you should be able to start an interactive Python window inside Emacs by typing [ESC] x py-shell [RETURN] (you may have to first switch to Python mode by typing [ESC] x python-mode [RETURN]). Alternatively, you can start an interactive Linux shell by typing [ESC] x shell and then type python at the command prompt.

Windows

  1. If your version of Emacs does not come with Python mode already, save the file python-mode.el to your machine and put it in the site-lisp folder of your Emacs installation. Usually this folder is located somewhere like C:\Program Files\Emacs\site-lisp.

  2. Add this code to your _emacs initialization file in the top-level C:\ directory on your hard drive (if you don't have an _emacs file in C:\, you'll need to create one first).

  3. To install the Python interpreter itself, download this file and then double-click on it. Also, add the following line to your _emacs file, in order to be able to run Python from inside Emacs:

    (setq py-python-command "C:\\Python24\\python.exe")
    
    This assumes that you installed the Python interpreter in C:\Python24. With that, you should be able to start an interactive Python window inside Emacs by typing [ESC] x py-shell [RETURN] (you may have to first switch to Python mode by typing [ESC] x python-mode [RETURN]).

Let me know if something doesn't work!