[ESS-bugs] ess-function-pattern not working for some valid functions

Toby Dylan Hocking Toby.Hocking at inria.fr
Thu Mar 10 15:00:33 CET 2011


Dear ESS developers,

First of all, thank you very much for ESS, a great piece of free
software which I use every day!

I like using the C-c C-f key sequence to load individual functions
into an inferior R process, but I noticed that it doesn't work for
some syntactically-valid functions, such as

comments.and.ex <- structure(function
### some docs
### more
(arg,
 arg2
 ){
  foo
### value
},ex=function(){
  some.code
})

To solve this problem, I propose a patch to ess-mode.el, which simply
updates the regular expression used to match functions.

I have attached the patch and some R code that illustrates several
example functions which are valid R code, but are not currently
matched by ess-function-pattern.

Does this patch pose any problem for you guys? Can you incorporate it
into the main ESS source code?

Thanks for the great package, and for your consideration,
Toby Dylan Hocking
http://cbio.ensmp.fr/~thocking/

-------------- next part --------------
testfun <- function(foo){
  bar
}
testfun <- function
(foo){
  bar
}
oneline <- function(foo)bar
comments <- function
### some docs
### more
(arg,
 arg2
 ){
  foo
###
}

comments.and.ex <- structure(function
### some docs
### more
(arg,
 arg2
 ){
  foo
###
},ex=function(){
  some.code
})


More information about the ESS-bugs mailing list