7

I understand from the following resources:

...that I should have access to tooltips for auto-complete help in emacs when using ESS for R development. The last link additionally specifies that it should work out of the box with the latest ESS, and:

From version 12.03 ESS integrates out of the box with auto-complete package.

Three sources ‘ac-source-R-args’, ‘ac-source-R-objects’ and ‘ac-source-R’ are included in ESS distribution. The latest combines previous two and makes them play nicely together.

I know that in general, my emacs tooltips are possible because they appear correctly with my python jedi setup in emacs.

However, my emacs auto-complete does not work. Instead, there is a buffer at the bottom:

enter image description here

instead of this, with the help superimposed on the working buffer:

enter image description here

And I have the following in my init.el:

(require 'auto-complete)
(setq ess-use-auto-complete t)
(ess-toggle-underscore nil)

I have the following versions of:

  ess                20131207.1141  installed  No description available.
  ess-R-data-view    20130509.458   installed  Data viewer for GNU R
  ess-R-object-popup 20130302.336   installed  popup description of R object
  auto-complete      20140208.653   installed  Auto Completion for GNU Emacs

What am I missing?

UPDATE 1

Here's my init for ESS stuff. This produces completions in a buffer, but not in a tooltip, where some configuration options from the manual have been added. (I have now tried all permutations of commenting and not commenting all of these):

(require 'auto-complete)
(global-auto-complete-mode)
(require 'auto-complete-config)
(ac-config-default)
(require 'ess-site)
(setq ess-use-auto-complete t)
(setq ac-auto-start 2)
(setq ac-auto-show-menu 0.2)
(ess-toggle-underscore nil)

UPDATE 2

Similar question here, but the same solution is suggested which did not actually result in tooltips on my setup. But it suggests to me this might be a platform issue? The poster there was also on Ubuntu 12.04 as I am---is it possible the solutions that worked for VitoshKa, Alex Vorobiev, and Iqbal Ansari were on a different platform? Are you guys using OS X?

UPDATE 3

Maybe other diagnostics:

ac-source-R is a variable defined in `ess-r-d.el'.
Its value is ((prefix . ess-ac-start)
 (candidates . ess-ac-candidates)
 (document . ess-ac-help))


Documentation:
Combined ad-completion source for R function arguments and R objects

ac-source-R-objects is a variable defined in `ess-r-d.el'.
Its value is ((prefix . ess-symbol-start)
 (candidates . ess-ac-objects)
 (document . ess-ac-help-object))


Documentation:
Auto-completion source for R objects

ac-source-R-args is a variable defined in `ess-r-d.el'.
Its value is ((prefix . ess-ac-start-args)
 (candidates . ess-ac-args)
 (document . ess-ac-help-arg))


Documentation:
Auto-completion source for R function arguments

[back]

where the variables for ess-ac[TAB] are only...

Click <mouse-2> on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
ess-ac-R-argument-suffix
ess-ac-sources

So maybe the problem is my ESS install is lacking all ess-ac-* things defined above, like ess-ac-args, etc?

Community
  • 1
  • 1
Mittenchops
  • 18,633
  • 33
  • 128
  • 246
  • 3
    I wish I knew too. I've tried to get this set up as well, and have never succeeded. – Josh O'Brien Mar 10 '14 at 16:44
  • I am able to get function argument completion. What is the value of `ac-auto-start`? Also try pressing `C-M-i`. –  Mar 10 '14 at 18:26
  • `M-x describe-variable` `ac-auto-start` says: ```ac-auto-start's value is 2 Documentation: Non-nil means completion will be started automatically. ``` – Mittenchops Mar 10 '14 at 18:38
  • C-M-i appears to have no effect. – Mittenchops Mar 10 '14 at 18:38
  • 1
    @Mittenchops I am guessing so bear with me. After `write.table(` type `fi` does it auto-complete, also try pressing `C-M-i` atleast something should happen, I am getting the completions –  Mar 10 '14 at 18:43
  • The buffer, at the bottom, still says the same, there is no proposed change to fi(le), and no tooltip or greyed out suggest in-text like with the python auto-complete. – Mittenchops Mar 10 '14 at 18:49
  • @Mittenchops Do not worry about the text at the bottom, it is `eldoc-mode` that is giving the function signature. Try updating the library, the latest version on `melpa` is 20140304.2344 –  Mar 10 '14 at 19:00
  • Also try to manually auto-complete by typing `write.file(f` and then doing `M-x auto-complete` –  Mar 10 '14 at 19:06
  • OK, apparently auto-complete-mode was not enabled, which I fixed with M-x auto-complete-mode. I thought my line: `(setq ess-use-auto-complete t)` would take care of that, but apparently it didn't. That's very strange. Could you phrase that as an answer I can mark as solved? – Mittenchops Mar 10 '14 at 19:35
  • You have to have at least one R processing running in the emacs to enable these features. Try `C-c C-n` on a line of R code first and then try these auto-completion and tooltip features. – RNA May 04 '14 at 07:49
  • Did you find a solution? My auto-complete also does not start automatically in ess mode (while it works perfectly in other modes). The same configuration works on debian, but fails on my freshly installed ubuntu. – user69818 May 25 '15 at 03:57
  • oh, I am sorry. I found out what is going wrong. Some settings do not work on my new os since something isn't installed, so emacs throws out warnings and stops loading the configurations before it reads the settings for ess and autocomplete. – user69818 May 25 '15 at 04:10

3 Answers3

2

My auto-complete configuration also has

(require 'auto-complete-config)
(ac-config-default)

and after that setting ess-use-auto-complete makes ESS show the popup menus.

Alex Vorobiev
  • 4,349
  • 21
  • 29
2

So as per your comments it turned out that auto-complete was not enabled in your emacs config. So just enable auto-complete by adding something like this in you init file

(load "auto-complete")
(global-auto-complete-mode)

Also for ESS you will need to set ess-use-auto-complete to t something like following would do

(setq ess-use-auto-complete t)

EDIT: ess-use-auto-complete is by default set to t so this step is not really needed.

Also since you found this option confusing I would recommend you to open an issue on the github repo so that the maintainers can improve the documentation (or code) whichever can reduce the confusion.

Auto-complete has a lot of configuration options do read the manual when you get time.

Glad I could help

  • 1
    It's weird, despite making these changes, the auto-complete never kicks in until the first time I run C-c C-c. It has to run to buffer before it seems to recognize the .R file as an R file. – Mittenchops Mar 16 '14 at 15:31
  • This is super weird. I did the same install on another machine and am back in the same problem as above. – Mittenchops Mar 16 '14 at 15:41
  • Same as in you are not getting auto-completions? –  Mar 16 '14 at 15:45
  • `the auto-complete never kicks in until the first time I run C-c C-c` that might because (I am guessing) `ess` uses the repl for auto-completion. –  Mar 16 '14 at 15:57
  • Yeah, installed on a new machine with the same init file and (I thought) same installations. It says the auto-complete-mode is enabled, so unclear. – Mittenchops Mar 16 '14 at 16:14
  • Strangely, no. I've now tried it out on 3 different Ubuntu installs, and it will only sporadically work. I wonder if there's some mixup with the standard auto-complete package and the ac-whatever packages necessary for R. It at least doesn't seem to be automatically installed with ESS, even with the settings for use-auto-complete. – Mittenchops Mar 17 '14 at 16:18
  • I added an update with my init.el details under UPDATE above. – Mittenchops Mar 17 '14 at 17:21
  • Hi @Mittenchops, there is an error in your `auto-complete` configuration. The variable `ac-auto-start` should be a number not `t`. Set it to something like 2. –  Mar 18 '14 at 03:22
  • Cool, thanks. I made that correction but still have the problem. =( – Mittenchops Mar 18 '14 at 04:06
  • Strange! It is working for me with your init file. What is your emacs version? –  Mar 18 '14 at 04:59
  • Emacs version is 24.3.1. Are you on OSX? My running theory is that there's an error in the packages for ac-source definitions that only affects Linux people, since my sources don't get referenced anywhere. – Mittenchops Mar 18 '14 at 13:17
  • 1
    No I am on Ubuntu 12.04. `My running theory ... don't get referenced anywhere.`. Looking at your `UPDATE 3`, the source are referenced to `ess-r-d.el`. Also I also have just variables with prefix `ess-ac` so this does not seem to be and issue. I just noticed that I do not get completions in a file unless I execute one of the `eval` command (eg `C-c C-c`). –  Mar 18 '14 at 14:39
  • I know a lot of the input sources can be installed via apt-get, by downloading from github, and also by some combination of MELPA, etc. Any chance you remember your order of installation on ac, versus ess, etc? – Mittenchops Mar 20 '14 at 15:52
  • I installed auto-complete and then ess from MELPA. –  Mar 20 '14 at 17:09
1

Don't confuse eldoc with auto-completion. Eldoc is what you have in your screenshot, it shows all arguments of a function without being intrusive. Auto-completion pops up when you start typing stuff and activates after ac-auto-start characters.

VitoshKa
  • 8,387
  • 3
  • 35
  • 59
  • I understand eldoc is what's in my screen shot, but it is my understanding I'm /also/ supposed to have auto-complete as well as a works-out-of-the-box component of ESS; and that is the part that is not working, despite having ESS. That was even from your links, right? – Mittenchops Mar 10 '14 at 19:22
  • @Mittenchops, you are right. It should work by default as long as you have auto-comlete loaded. Check if it works in other modes like elisp. – VitoshKa Mar 11 '14 at 19:57
  • Weird, it does work in anything, such as when I'm editing my init.el, I get perfect auto-completes in tooltip for, say, setq autocompleting after 'set.' It's just R/ESS that does not get successful autocompletes. It's as if it doesn't know where to look for definitions or something. I added the items in my init.el to the question after UPDATE. – Mittenchops Mar 17 '14 at 17:23
  • @Mittenchops try to investigate, there might be some error showing in the minibuffer. See the values of `ac-sources`, check if auto-complete is enabled, try to use ess-ac sources directly etc – VitoshKa Mar 18 '14 at 16:36