Christophe Weblog Wiki Code Publications Music
fix multibyte decoding protocol bug
[swankr.git] / swank-c-p-c.R
1 `swank:completions` <- function(slimeConnection, sldbState, prefix, package) {
2   bits <- strsplit(prefix, "(?=[A-Z._])", perl=TRUE)[[1]];
3   lrx <- literal2rx(bits)
4   ## FIXME: this includes slightly too much .*, because the strsplit
5   ## seems to split before /and/ after the match.
6   rx <- paste(lrx, collapse=".*")
7   matches <- apropos(sprintf("^%s", rx), ignore.case=FALSE)
8   nmatches <- length(matches)
9   if((nmatches == 0) && ((dollar <- regexpr("$", prefix, fixed=TRUE)) > -1)) {
10     
11     symbolFieldsCompletion(globalenv(), prefix, prefix)
12   } else {
13     returnMatches(matches)
14   }
15 }