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

Friedrich Leisch friedrich.leisch at stat.uni-muenchen.de
Wed May 24 10:39:28 CEST 2006


>>>>> On Tue, 23 May 2006 11:07:32 +0200,
>>>>> Martin Maechler (MM) wrote:

>>>>> "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,

Being one of those people (and the first one as author of
edit.vignette) I must reject the subtle suggestion that I never
thought about it.


  > 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.


edit(vignette(...)) works fine for me, the only thing that may be hard
to find out for users is that you have to press C-c C-c in the R
buffer to get back to the prompt (by default R waits for the file to
be closed), but once you have done that you can edit the vignette
code, send it line by line to R etc.


  > 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.

No problem with that, but I think that is not the main issue,
file.edit() on general does not exactly what I would expect under ESS
and that is at least unfortunate given that we are inside the best
editor available.

E.g., we should fix (in R) that one can only open one file at a time
in ESS, and R should not wait for the file to be closed but be more
like on windows (shudder, did I write that?), where you can open
multiple files.  Waiting is fine if you run in an xterm and open vi
(which captures the terminal anyway), but is stupid in ESS.



.f




More information about the ESS-bugs mailing list