On 4/9/08, Herve Pages <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  Let's create the xxx object just to avoid confusion even if it's not 
> necessary
>  for reproducing the problem below:
>
>    xxx <- 8:3
>
>  If I start typing this:
>
>    max(xxx[
>
>  and now try to autocomplete with <TAB>, then I get the following error (and 
> a warning):
>
>    > max(xxx[Error in grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, 
> value = TRUE) :
>      invalid regular expression '^xxx['
>    In addition: Warning message:
>    In grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value = TRUE) :
>      regcomp error:  'Invalid regular expression'

Thanks for the report, makeRegexpSafe was not escaping "[". Does the
following workaround fix the problem (without introducing additional
ones)?

assignInNamespace("makeRegexpSafe", ns = "utils", value = function(s)
{
    s <- gsub(".", "\\.", s, fixed = TRUE)
    s <- gsub("?", "\\?", s, fixed = TRUE)
    s <- gsub("[", "\\[", s, fixed = TRUE)
    s <- gsub("]", "\\]", s, fixed = TRUE) # necessary?
    s
})

(with 2.6.x, replace "utils" with "rcompgen")

-Deepayan

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to