This is a minor but long-standing irritant possibly related to #1149. Try loading the following function definitions using C-c C-c:
## This one works fine
foo <- function(x, y, ...) { # This is a comment
return(x + y)
}
## This one gives an error
bar <- function(x, y, ...) # This is a comment
{
return(x + y)
}
## Selecting + C-c C-r works
The same behaviour is seen with these variants:
bar <- function(x, y, ...)
### x: first argument
### y: second argument
### ...: ignored
{
return(x + y)
}
bar <- function(x, y, ...)
## x: first argument
## y: second argument
## ...: ignored
return(x + y)
The only commonality that I can see that consistently triggers this bug is a comment between the formals and the body, but it also requires the function assignment. Both of the following work:
function(x, y, ...)
## This is a comment
{
return(x + y)
}
(function(x, y, ...)
## This is a comment
{
return(x + y)
})(4, 5)
This is not a showstopper by any means, but perhaps these reproducible examples will make it easier to fix.
This is a minor but long-standing irritant possibly related to #1149. Try loading the following function definitions using
C-c C-c:The same behaviour is seen with these variants:
The only commonality that I can see that consistently triggers this bug is a comment between the formals and the body, but it also requires the function assignment. Both of the following work:
This is not a showstopper by any means, but perhaps these reproducible examples will make it easier to fix.