[ESS-bugs] ess-beginning-of-function - bug in {R and S}-mode

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Wed Jul 6 11:15:20 CEST 2005


 > C-M-a and C-M-e   and all other ess-function-* commands fail 
 > for things like
 > 
 >   myfun <-
 >     ## bla1
 >     ## bla2
 >     ## bla3
 >     ## bla4
 >     function(x) {
 >      .........
 >      .........
 >     }
 > 
 > as long as your (point) is inside the  '## bla.' comment lines
 > 
 > John Chambers has been using this syntax extensively,
 > and actually S4 has defined that the '## bla?" lines are made
 > into a ``dummy help page'' as long as no real help page exists.
 > and IIRC, this even works in S-plus {but not in R}.

sounds like a good way to get docstrings, in the same way that Emacs
does at the top of a function definition!  I'd have slightly prefered
the look of something like:

myfun <- function(x) {
 ## bla1
 ##...
 code
}

but if it is already in S and John C uses it, that's good enough for
me to start thinking about changing.  (Is it likely that R will adopt
this convention for an informal doc string?)

I'm unlikely to get a chance to look at this soon, but will put it on
my list of things to look at, as it sounds like a good thing to
encourage documentation in this way.

Presumably this form of function definition also is not captured by
the imenu code?

Stephen




More information about the ESS-bugs mailing list