[ESS] trace(edit=TRUE) under MS Windows

Ross Boylan ross at biostat.ucsf.edu
Thu Mar 7 02:41:19 CET 2013

I just tried

> trace(mice.impute.2L.norm, where=mice, edit=TRUE, print=FALSE)
Error in edit(name, file, title, editor) :
   unable to run editor 'emacsclient.exe'

Emacs 24.2.1, ESS 12.09-1, Windows 7, R 2.15.2.

A few observations:
I suspect this isn't working because my PATH doesn't include the right 
directory.  I tried setting the full path, but still had problems:

> getOption("editor")
[1] "C:\\Program Files\\GNU Emacs 24.2\\bin\\emacsclient.exe"
> trace(mice.impute.2L.norm, where=mice, edit=TRUE, print=FALSE)
C:\PROGRA~1\GNUEMA~1.2\bin\EMACSC~1.EXE: No socket or alternate editor.  Please use:

	--server-file      (or environment variable EMACS_SERVER_FILE)
	--alternate-editor (or environment variable ALTERNATE_EDITOR)

Some of the R functions seem to attempt to hardcode for emacs, but they 
don't know that emacsclient.exe is emacs.  In particular, 
.makeTracedFunction() includes this code:

         if (is(editor, "character") && !is.na(match(editor, c("emacs",
             "xemacs")))) {
             file <- tempfile("emacs")
             file <- sub("..$", ".R", file)
         else file <- ""

It might be good to adjust either R or ESS for greater compatibility.

Finally, the ESS info file says

4.7 Using emacsclient

When starting R or S under Unix, ESS sets
`options(editor="emacsclient")'.  (Under Microsoft Windows, it will use
gnuclient.exe rather than emacsclient, but the same principle applies.)

That doesn't seem to be true, at least on my MS Windows machine.  I have 
no customizations related to this in my .emacs file.

Ross Boylan

More information about the ESS-help mailing list