[ESS-bugs] ess-beginning-of-function - bug in {R and S}-mode
Martin Maechler
maechler at stat.math.ethz.ch
Tue Jul 5 15:19:35 CEST 2005
I've just renamed <ess>/etc/indent-wrong.R
to etc/R-ESS-bugs.R
and added an example which demonstrates the bug:
This bug applies to both R- and S-mode , i.e. typically when
using *.R and *.S (or *.q) source files.
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}.
The error message happens from this part
in (defun ess-beginning-of-function) :
(while (not done)
(if (re-search-backward ess-function-pattern (point-min) t)
nil
(goto-char init-point)
(error "Point is not in a function.")
))
where the culprit is really ``hidden in'' the variable
ess-function-pattern which is initialized from e.g.,
ess-R-function-pattern from ess-cust.el
But I don't see how, since line 644 {ess-cust.el} has
"\\(\\(\\s-\\|\n\\)*\\s<.*\\s>\\)*" ; whitespace, comment
i.e. *is* supposedly looking for comment lines before the
'function(..)' keyword.
Does anyone have an idea?
Martin
More information about the ESS-bugs
mailing list