[ESS] roxygen question

Martin Maechler maechler at stat.math.ethz.ch
Thu Apr 30 12:17:24 CEST 2009


>>>>> "RMK" == Rainer M Krug <r.m.krug at gmail.com>
>>>>>     on Thu, 30 Apr 2009 11:16:59 +0200 writes:

    RMK> On Mon, Apr 20, 2009 at 10:26 AM, Stephen Eglen
    RMK> <S.J.Eglen at damtp.cam.ac.uk> wrote:
    >> Rainer M Krug <r.m.krug at gmail.com> wrote:
    >> 
    >>> Hi
    >>> 
    >>> I want to use roxygen and the function ess-roxygen-fn but I have a
    >>> problem. I am using the package simecol, and my functions are defined
    >>> as follow:
    >>> 
    >>> 
    >>> equations(ASM)$germSpecies <- function(param, species) { ... }
    >>> 
    >>> When I call ess-roxygen-fn (bound to C-c C-o), I get the error message:
    >>> 
    >>> "Point is not in a function according to 'ess-function-pattern'"
    >> 
    >> This error occurs due to ess not being able to find the start of
    >> function; although you've called an roxygen function, the error is in:
    >> ess-beginning-of-function -- try calling that function within the braces
    >> and you'll see the same error.
    >> 
    >>> Is it possible to change these pattern?
    >> 
    >> mmm... the place to start looking would be the variable
    >> ess-function-pattern, but you will see that is quite complex already.
    >> I guess the problem you are hitting is the fact that you have  () on the
    >> left hand side of the assignment operator, i.e. '(ASM)'

    RMK> Where can I find this variable, so that I can see if I can modify it?

Beware that it's not just the variable, it's also the exact
circumstances it is used.
I and probably many ESS programmers  have spent many hours on
this in the past, and I don't think there is a "truly perfect"
solution, unless emacs(ESS) calls the R parser and analyzes its
results.

The code resides in  <ess>/lisp/ess-mode.el,
the principal function is  ess-beginning-of-function
and the patterns are defined -- modularly, also in order to
differentiate versions of the S language --
mostly inside the  (let ...) statement *before* the 
(defun ess-beginning-of-function .......)

But __ again __ do *not* even start looking at this unless you
are an experienced programmer (or are very eager to become on
eventually).

I'm sure that ESS-core will have to be very cautious about
accepting patches to the current code there.

Do also look at examples in  <ess>/etc/R-ESS-Bugs.R 
most of which now work (and did not in the past) !

Martin Maechler, ETH Zurich

    RMK> -- 
    RMK> Rainer M. Krug, Centre of Excellence for Invasion Biology,
    RMK> Stellenbosch University, South Africa



More information about the ESS-help mailing list