[ESS] ESS/R completion UI

Erik Iverson iverson at biostat.wisc.edu
Sun Feb 1 18:41:41 CET 2009


Hello,

R provides a relatively sophisticated completion mechanism through its "utils" 
package, functions ".guessTokenFromLine", ".completeToken", and 
".retrieveCompletions."  For instance, these functions recognize the '$' 
character for lists, and will complete names within the list after that 
character.  I did not realize this until recently, but go to your *R* buffer, and do
 >   test <- list(temp1 = 1, temp2 = 2, temp3 = 3, another = 4)
and then try
 >   test$t , and hit TAB.  It should complete "temp" and upon hitting TAB 
again, provide the possible completions in a separate window.

They also recognize function argument names, so that
 >   lm( TAB will show the function arguments in another window.
This is all provided with R, no ESS needed.

ESS adds to this mechanism by providing completions in R source buffers, by 
default with C-c TAB.

There are now several "completion frameworks" provided as Emacs packages.  These 
packages attempt to provide a UI framework for completion, as an abstraction 
layer that connects to whatever backend you want (in our case, the R functions 
above).  The idea is that the completion UI would look the same whether you're 
completing R functions, C++ objects, Python functions, etc.

There is company-mode http://nschum.de/src/emacs/company-mode/, demo movie at 
http://nschum.de/src/emacs/company-mode/screencast/.

There is Auto Complete, http://www.emacswiki.org/emacs/AutoComplete#toc4, with 
demo movie at http://www.cx4a.org/pub/ac-demo/ac-demo.html.

And there is CompletionUI, at http://www.emacswiki.org/emacs/CompletionUI.

Does anyone use any of these for R, or anything else at this point?

I do have some code that uses R with company-mode, but I just found out about 
these other two frameworks recently.  So, does anyone else use these things, 
that can offer any pros/cons between the packages?

Erik




More information about the ESS-help mailing list