Emacs & ESS under Windows
paradis at isem.univ-montp2.fr
Tue Mar 6 16:50:09 CET 2001
Thanks again to those who helped me to improve what is below. About the
advantages of using ESS, I do not repeat here the opinions that have been
sent recently on r-help (see particularly the messages by Prof Brian
Ripley, Rich Heiberger, Peter Dalgaard, Faheem Mitha, Renaud Lancelot,
Guido Masarotto; they should be in the list archive under the subject: Re:
[R] Emacs & ESS under Windows). See also the R-FAQ.
If I have still missed something, do not hesitate to tell me.
Short guide to install ESS under Windows
The following summary is for a Windows system (mainly NT, but this applies
to 95/98 too) which has none of Emacs, gnuserv, or ESS installed. Sections
1 and 2 are about getting and installing Emacs, sections 3-6 are about
getting and installing ESS, section 7 is about getting and installing
gnuserv, and section 8 gives a few hints on how to start with ESS.
It is assumed that all packages are or will be installed in D:\ (if you
choose another location, change accordingly). It is preferable to install
these packages (including R) in locations independent of each others, so
that they can be updated easily.
1. Download a precompiled copy of Emacs v. 20.7 for Windows on Intel machines:
This is a 13 Mb file that includes precompiled binaries of Emacs, and lisp
source (useful for understanding how packages work, and how they can best
be setup or customized).
2. Unpack the downloaded file in a directory, e.g., "D:\", then execute the
file "D:\emacs-20.7\addpm.exe". Emacs is then installed on your Windows
machine, and a shortcut should have been added to your Start menu.
Installing Emacs may not be so straightforward depending on the setup of
your system. For instance, it may be better to turn off virus checkers
(Norton Anti-Virus 2001 breaks this, for example; McAfee virus scanner
seems to interact badly with Emacs too). There is a very detailed FAQ for
Emacs on Windows at:
Section 3 of this FAQ details the installation process of Emacs under
Windows. There are also lots of useful informations on how to customize Emacs.
It is also recommended to change the default starting directory for Emacs
to you own personal directory to help protect you from accidentally
changing files in the Emacs directory. Do so by right-clicking on the Emacs
short-cut, go to the "Shortcut" tab, and then change the value in "Start in:".
3. Download ESS v. 5.1.18 at:
It is a 558 Kb file.
4. Unpack the downloaded file in its own directory, e.g. "D:\" (of course,
keeping the tree structure of the zip archive). Avoid unpacking this
archive in the Emacs (sub)-directory(ies) so that you can upgrade Emacs and
ESS independently in the future.
5. Edit the file "D:\ess-5.1.18\lisp\ess-site.el". In this file, the
semicolons indicate comments. Find the line #250 (easy with Emacs...) which
is like this:
;;(setq-default inferior-R-program-name "Rterm") ; msdos systems
This line tells ESS where to find the R executable. Thus, uncomment the
line, and write in place of "Rterm" where is your Rterm.exe, for instance,
is you installed R v. 1.2.2 for Windows in D:\, the line becomes:
(setq-default inferior-R-program-name "D:/rw1022/bin/Rterm") ; msdos systems
Of course, you may delete the string "; msdos systems". If you installed R
in C:\Program Files, then the line must be:
(setq-default inferior-R-program-name "C:/Progra~1/rw1022/bin/Rterm")
taking care to use the DOS name of the directory.
Note that you may use "Rgui" instead of "Rterm", but R's outputs will be
displayed in the Rgui console rather than within Emacs (as is the case with
6. Edit or create a file called ".emacs" (or "_emacs"). You can read some
infos on "What is a .emacs file?" at:
When Emacs is started, it looks for the .emacs file in your HOME directory.
HOME is an environment variable which can be set in several ways. Under
Windows NT, open the Control Panel, go to the System panel, and click the
"Environment" tab, then add (or modify) the appropriate environment
variable. (This procedure gives the possibility to set HOME on a per-user
basis.) Under Windows 95, you can set the HOME environment variable in your
autoexec.bat file (you will need to reboot). If no HOME has been set, Emacs
will look for .emacs in C:\.
Once HOME has been set, add in .emacs the following line:
7. ESS is now configured to run with R and Emacs, but it is very useful to
install gnuserv, a small program that allows file associations with Emacs
(thus loading files into an already running Emacs, or if none, one is
launched). More information are at:
where there is also a link to download gnuserv, or:
Unpack the dowloaded file, e.g. in D:\, and add in .emacs the following
You also need to have the gnuserv executables and runemacs.exe in your path
(under Windows NT, this is done by editing the PATH environment variable in
the System panel of the Control Panel), in our example, one needs to add
"D:\emacs-20.7\bin;D:\gnuserv;" to this environment variable.
Now, open Explorer, select "options" in the menu "view", select the "file
types" tab, click on "New type...", fill the fields (specifying, of course,
the .R extension), and under "actions", click "New...", a new window is
then open. Under "action" type "open", and in the second field type
where the "%1" allows filenames with blanks in them to bee treated as one
argument when sent to Emacs. Close all windows by clicking "Ok".
8. When you open a *.R file, this opens Emacs and ESS. To run R under
Emacs, type Alt-x R (M-x R in Emacs' terminology), and then Enter (this
will open a DOS-like window, so you have to come back to Emacs). Within
Emacs, you switch between the different files, buffers, processes, ... with
the menu "Buffers". When you edit a *.R file you can evaluate the R
expressions with the "ESS" menu by selecting "eval buffer" (or by typing
Ctrl-c Alt-b, ... I mean C-c M-b).
ess-help mailing list -- To (un)subscribe, send
subscribe or unsubscribe
(in the "body", not the subject !) To: ess-help-request at stat.math.ethz.ch
More information about the ESS-help