[ESS-bugs] ... 'edit(vignette("zoo"))' ...

Martin Maechler maechler at stat.math.ethz.ch
Tue May 23 11:07:32 CEST 2006


>>>>> "tony" == A J Rossini <blindglobe at gmail.com>
>>>>>     on Mon, 22 May 2006 16:26:40 +0200 writes:

    tony> The usual questions: #1 - does it still happen when
    tony> you upgrade?  (I think it will, but you are many
    tony> versions behind).

(yes it does still happen, but yes you *should* upgrade ESS)

    tony> #2 - Why are you editing from an R function rather
    tony> than just loading in the file?

Because too many people in too many places / documents tell you
to do
      edit(vignette("<vignettename>"))

and say that it is a bug of ESS that it doesn't work.

I have found it very unfortunate that those people didn't think
a bit longer, but OTOH, I think we (ESS developers) can and
should do something about it ... after all we have the powerful
emacs machine to our disposal. 

What should we do?

In R, help(vignette) contains

 >> The edit method extracts the R code from the vignette to a
 >> temporary file and opens the file in an editor. 

and the  'edit.vignette' method is a very simple function :

  function (name, ...)
  {
      f <- paste(tempfile(name$topic), ".R", sep = "")
      Stangle(name$file, output = f, quiet = TRUE)
      file.edit(file = f, ...)
  }

and file.edit() really just uses  getOption("editor") 
which is "emacsclient" in ESS for GNU emacs and which seems to badly
fail here for some reason --- even for me who has the equivalent
of M-x server-start  somewhere in my Emacs / ESS initialization ---
just giving 
     >> emacsclient: connect: Connection refused
or in further attempts it complains about an already running
emacsclient.
So I think there's a definitive  emacsclient problem at least
with R's internal way of calling it --- any insight here ?
Otherwise, we probably need to carry the problem to R-devel.

If we (R-core) would allow to use 'quiet = FALSE' in the above
Stangle() statement, the user at least would see something like
------------------------------------------------
Writing to file /tmp/RtmppGX7Wj/grid625558ec.R 
------------------------------------------------
and could just manually open that in Emacs.


BTW: 

1) The 'grid' vignette sources are all *.Snw  (and not *.Rnw)
   files.  Currently ESS only goes into R-noweb mode for *.Rnw.
   Should we also do so for *.Snw files ?

 [ To Kurt & Fritz and me : ]

2) If you have about a 1000 packages installed like I do,
   vignette("<specific_name>") 
   is *deadly* slow --- even after (allvign <- vignette()) has
   already been called -- I think R should cache some tables
   here...




More information about the ESS-bugs mailing list