[ESS-bugs] ... 'edit(vignette("zoo"))' ...
Martin Maechler
maechler at stat.math.ethz.ch
Wed May 24 23:26:56 CEST 2006
>>>>> "FrL" == Friedrich Leisch <friedrich.leisch at stat.uni-muenchen.de>
>>>>> on Wed, 24 May 2006 10:39:28 +0200 writes:
>>>>> 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,
FrL> Being one of those people (and the first one as author
FrL> of edit.vignette) I must reject the subtle suggestion
FrL> that I never thought about it.
Please apologize, Fritz, if I made it seem I meant you.
I rather meant comments people made in mailing lists and I think
in bioconductor courses / documents.
>> 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.
FrL> edit(vignette(...)) works fine for me, the only thing
FrL> that may be hard to find out for users is that you have
FrL> to press C-c C-c in the R buffer to get back to the
FrL> prompt (by default R waits for the file to be closed),
FrL> but once you have done that you can edit the vignette
FrL> code, send it line by line to R etc.
Thanks for that: This is interesting to hear. I used to use
the emacsclient quite a bit for a while in the past but for some
reasons hadn't done so anymore in recent years.
However, IIRC, edit(vignette(..)) had never worked for me (*)
And I never started looking into it (because I typically worked
with the *.Rnw file anyway) till yesterday when I wrote
that e-mail.
(*) Now that I try it at home,
it works fine. So it's just at work where my Emacs setup seems
screwed.
By the way, for me (and I think by default), it's 'C-x #' and
not C-c C-c {which would be much easier for "users" I think}
that is needed to leave the emacsclient "server-edit" mode,
isn't it ?
>> 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.
FrL> No problem with that, but I think that is not the main
FrL> issue, file.edit() on general does not exactly what I
FrL> would expect under ESS and that is at least unfortunate
FrL> given that we are inside the best editor available.
FrL> E.g., we should fix (in R) that one can only open one
FrL> file at a time in ESS, and R should not wait for the
FrL> file to be closed but be more like on windows (shudder,
FrL> did I write that?), where you can open multiple files.
FrL> Waiting is fine if you run in an xterm and open vi
FrL> (which captures the terminal anyway), but is stupid in
FrL> ESS.
That sounds reasonable, and good to wish.
Yes, contrary to other edit*() functions that *return*
something, file.edit() really should behave ``asynchronously''
to R.
Martin
More information about the ESS-bugs
mailing list