Tim, if you want to experiemnt with this, the source for that function is in
/Applications/R.app/Contents/Resources/GUI-tools.R and I will certainly entertain patches. As for .Rprofile, it is run before the GUI adds its tools to the search path so you can't modify it there. Cheers, Simon > On Oct 1, 2018, at 9:57 AM, Tim Bates <timothy.c.ba...@gmail.com> wrote: > > Simon very kindly wrote this function a couple of years ago when I noted how > nice it would be if pressing tab on an already-completed unique name would > write a $ sign and give a drop-down of $ elements. > > I'd like to improve the function so that if the completion is a function > name, then pressing tab adds "()" (preferably leaving the cursor in the > brackets) > > > umx_complete_dollar <- function () { > RGUI = as.environment("tools:RGUI") > RGUI$rcompgen.completion <- function(x) { > comp <- function(x) { > utils:::.assignLinebuffer(x) > utils:::.assignEnd(nchar(x)) > utils:::.guessTokenFromLine() > utils:::.completeToken() > utils:::.CompletionEnv[["comps"]] > } > res <- unique(comp(x)) > if (nzchar(x) && identical(res, x) && !identical(substr(x, > nchar(x), nchar(x) + 1L), "$")) { > rc <- comp(paste0(x, "$")) > if (!identical(substr(rc, nchar(rc), nchar(rc) + > 1L), "$")) > res <- rc > } > res > } > } > > > Also, I added the function to my ~/.Rprofile, but this function can't > execute then ( as.environment("tools:RGUI") fails with "tools:RGUI is not > in the search list" > > Any clues to improving these? The functionality is worth its weight in gold, > IMHO. > _______________________________________________ > R-SIG-Mac mailing list > R-SIG-Mac@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-mac > _______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac