36

Rstudio has a great code completion feature. It provides a quick view of functions that start with a given string, as well as function and parameter definitions.

ESS is powerful enough, familiar to me, and integrated into Emacs, where I conduct most of my work - so I am hesitant to move, but this feature is making me consider such a move.

Is it possible to integrate this feature into Emacs ESS?

Is there anything similar to this for Emacs ESS?

Any hope that there will be (and if so, how could I support such an effort?)

enter image description here

Abe
  • 12,956
  • 12
  • 51
  • 72

3 Answers3

27

You do get the completion thanks to the rcompgen package by Deepayan (now "promoted" into base R as part of the utils package). So when I type

lm(

and hit TAB a new buffer opens which gets me the left-hand side of your window above: the available options to the function at hand. I don't think you can show the help directly though.

There is / was also a way to get context-sensitive help in the mini-buffer when typing but I have forgottten how/where that gets turned on.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
20

[EDIT: This is an old answer and auto-complete package dropped out of fashion since then. Please use company-mode instead. It should work by default. Wiki configuration entry is here.]

Recent versions of ESS (> v.12.02) integrate with auto-complete package out of the box (you need not configure anything, just install auto-complete). It provides help on arguments as well as function help. I added detailed instructions to the wiki

Ess-ac screenshot

enter image description here

Ess-eldoc was also rewritten and from v.12.02 it's active by default, so you don't need to configure anything.

VitoshKa
  • 8,387
  • 3
  • 35
  • 59
  • Vitoshka is that `solarize` theme that you're using? – aL3xa Feb 23 '12 at 00:11
  • yes @aL3xa, after years of using calm forest dark theme I've switched to `solarize` recently and am quite happy with it :) – VitoshKa Feb 23 '12 at 13:28
  • FWIW, I'm using tango dark theme and I'm happy with it, but I'd like to try out solarize. Looks nice. – aL3xa Feb 23 '12 at 14:57
  • How did you setup your .emacs so that help is shown in full "glory"? :) On my machine the corresponding help pop-up is rather small and ugly. – fotNelton Mar 30 '12 at 16:36
  • @fotNelton Sorry for being late. Didn't notice the response. I have `ac-quick-help-prefer-pos-tip` set to `t` and `(require 'pos-tip)`. You can play with colors as on examples in the wiki link above. – VitoshKa Jun 05 '12 at 15:43
  • @VitoshKa Oh, no problem at all, thank you very much for your answer. I'll give it a try as soon as possible :) – fotNelton Jun 06 '12 at 05:30
  • @VitoshKa I followed your [wiki edits](https://www.emacswiki.org/emacs/ESSAuto-complete), putting in `(define-key ac-completing-map (kbd "M-d") 'ac-quick-help)` but the "M-h" is still bound to "mark paragraph". I tried other keybindings and it doesn't work either. Could you check this please? – Heisenberg Mar 23 '17 at 03:20
  • 1
    @Heisenberg, you are binding it to `M-d` not `M-h`. Consider using compay-mode btw. I have updated the answer. – VitoshKa Mar 24 '17 at 13:24
5

Or maybe we should all use search:

Emacs autocomplete-mode extension for ESS and R

I don't want to be grumpy, I found this few hours ago and I'm still shocked. It works like a charm. Though I still prefer the old-style pop-ups. =)

Community
  • 1
  • 1
aL3xa
  • 35,415
  • 18
  • 79
  • 112
  • that's not really an answer, its more of a comment, but the point could be better made with a vote to close as exact duplicate, as I have done. – Abe Sep 21 '11 at 21:50