X-Git-Url: http://christophe.rhodes.io/gitweb/?p=swankr.git;a=blobdiff_plain;f=swank-c-p-c.R;fp=swank-c-p-c.R;h=8d3318475564b000f45e60a49e3612e3e3169235;hp=0000000000000000000000000000000000000000;hb=5d025413767efe93bebe3cadbaeb7906a150d50b;hpb=5ca0271393659195cb5a87e423858eed16eacfa4 diff --git a/swank-c-p-c.R b/swank-c-p-c.R new file mode 100644 index 0000000..8d33184 --- /dev/null +++ b/swank-c-p-c.R @@ -0,0 +1,15 @@ +`swank:completions` <- function(slimeConnection, sldbState, prefix, package) { + bits <- strsplit(prefix, "(?=[A-Z._])", perl=TRUE)[[1]]; + lrx <- literal2rx(bits) + ## FIXME: this includes slightly too much .*, because the strsplit + ## seems to split before /and/ after the match. + rx <- paste(lrx, collapse=".*") + matches <- apropos(sprintf("^%s", rx), ignore.case=FALSE) + nmatches <- length(matches) + if((nmatches == 0) && ((dollar <- regexpr("$", prefix, fixed=TRUE)) > -1)) { + + symbolFieldsCompletion(globalenv(), prefix, prefix) + } else { + returnMatches(matches) + } +}