[ESS] ESS/R completion UI

Sebastian P. Luque spluque at gmail.com
Sun Feb 1 19:53:30 CET 2009


On Sun, 01 Feb 2009 11:41:41 -0600,
Erik Iverson <iverson at biostat.wisc.edu> wrote:

> 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?


Hi Erik,

I haven't tried any of the above, but I have been happily using the
completion mechanism offered by Icicles set of libraries
(http://www.emacswiki.org/emacs/Icicles).  Drew Adams (cc'ed here)
develops and maintains these libraries, and he has recently made Icicles
work together with comint so that it offers catches completions that
comint creates.  I think this covers a lot of the ground you describe,
because most of these languages have an Emacs mode that handle the
interpreter processes through comint.  Hence, Icicles now offers
completion in e.g. shell mode.  Recently, I helped a bit making Icicles
aware of the completion mechanism built on ESS, and the following
functions are now available:

`icicle-ess-complete-filename'
`icicle-ess-complete-object-name'
`icicle-ess-internal-complete-object-name'
`icicle-ess-R-complete-object-name'

which, as you might guess, are alternatives for the ESS functions.
Icicles has a system that makes it easy to add such alternatives for
completion of objects in modes for other languages.  More details can be
found in the wiki pages in the link above, and the libraries are very
well documented.


-- 
Seb




More information about the ESS-help mailing list